def test_duplicates_are_kept(self): concat_map = ['c:@F@fun1#I# ast/fun1.c.ast', 'c:@F@fun2#I# ast/fun2.c.ast', 'c:@F@fun1#I# ast/fun1.c.ast'] pairs = sut.create_global_ctu_extdef_map(concat_map) self.assertTrue(('c:@F@fun1#I#', 'ast/fun1.c.ast') in pairs) self.assertTrue(('c:@F@fun2#I#', 'ast/fun2.c.ast') in pairs) self.assertEqual(2, len(pairs))
def test_not_unique_func_left_out(self): concat_map = ['c:@F@fun1#I# ast/fun1.c.ast', 'c:@F@fun2#I# ast/fun2.c.ast', 'c:@F@fun1#I# ast/fun7.c.ast'] pairs = sut.create_global_ctu_extdef_map(concat_map) self.assertFalse(('c:@F@fun1#I#', 'ast/fun1.c.ast') in pairs) self.assertFalse(('c:@F@fun1#I#', 'ast/fun7.c.ast') in pairs) self.assertTrue(('c:@F@fun2#I#', 'ast/fun2.c.ast') in pairs) self.assertEqual(1, len(pairs))
def test_multiple_maps_merged(self): concat_map = ['c:@F@fun1#I# ast/fun1.c.ast', 'c:@F@fun2#I# ast/fun2.c.ast', 'c:@F@fun3#I# ast/fun3.c.ast'] pairs = sut.create_global_ctu_extdef_map(concat_map) self.assertTrue(('c:@F@fun1#I#', 'ast/fun1.c.ast') in pairs) self.assertTrue(('c:@F@fun2#I#', 'ast/fun2.c.ast') in pairs) self.assertTrue(('c:@F@fun3#I#', 'ast/fun3.c.ast') in pairs) self.assertEqual(3, len(pairs))
def test_space_handled_in_source(self): concat_map = ['c:@F@fun1#I# ast/f un.c.ast'] pairs = sut.create_global_ctu_extdef_map(concat_map) self.assertTrue(('c:@F@fun1#I#', 'ast/f un.c.ast') in pairs) self.assertEqual(1, len(pairs))
def test_no_map_gives_empty(self): pairs = sut.create_global_ctu_extdef_map([]) self.assertFalse(pairs)