Fix for mixed version loclists, tests (#521)
[pyelftools.git] / test / test_dwarf_attr_form_flag_present.py
1 #-------------------------------------------------------------------------------
2 # elftools tests
3 #
4 # Eli Bendersky (eliben@gmail.com), Santhosh Kumar Mani (santhoshmani@gmail.com)
5 # This code is in the public domain
6 #-------------------------------------------------------------------------------
7 import os
8 import unittest
9
10 from elftools.elf.elffile import ELFFile
11
12
13 class TestAttrFormFlagPresent(unittest.TestCase):
14 def test_form_flag_present_value_is_true(self):
15 with open(os.path.join('test', 'testfiles_for_unittests',
16 'lambda.elf'), 'rb') as f:
17 elffile = ELFFile(f)
18 self.assertTrue(elffile.has_dwarf_info())
19
20 dwarf = elffile.get_dwarf_info()
21 for cu in dwarf.iter_CUs():
22 for die in cu.iter_DIEs():
23 for _, attr in die.attributes.items():
24 if attr.form == "DW_FORM_flag_present":
25 self.assertTrue(attr.value)