Exemplo n.º 1
0
 def test_dependency_ordering_with_dependency_in_reverse_order(self):
     ir = _find_dependencies_for_snippet("struct Foo:\n"
                                         "  b [+4]  UInt  a\n"
                                         "  0 [+4]  UInt  b\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([1, 0], struct.fields_in_dependency_order[:2])
Exemplo n.º 2
0
 def test_dependency_ordering_with_parameter(self):
     ir = _find_dependencies_for_snippet("struct Foo:\n"
                                         "  0 [+1]  Bar(x)  b\n"
                                         "  1 [+1]  UInt    x\n"
                                         "struct Bar(x: UInt:8):\n"
                                         "  x [+1]  UInt    y\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([1, 0], struct.fields_in_dependency_order[:2])
Exemplo n.º 3
0
 def test_dependency_ordering_multiple_dependencies(self):
     ir = _find_dependencies_for_snippet("struct Foo:\n"
                                         "  b+c [+4]  UInt  a\n"
                                         "  4 [+4]    UInt  b\n"
                                         "  8 [+4]    UInt  c\n"
                                         "  a [+4]    UInt  d\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([1, 2, 0, 3], struct.fields_in_dependency_order[:4])
Exemplo n.º 4
0
 def test_dependency_ordering_scrambled(self):
     ir = _find_dependencies_for_snippet("struct Foo:\n"
                                         "  d [+4]   UInt  a\n"
                                         "  c [+4]   UInt  b\n"
                                         "  a [+4]   UInt  c\n"
                                         "  12 [+4]  UInt  d\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([3, 0, 2, 1], struct.fields_in_dependency_order[:4])
Exemplo n.º 5
0
 def test_dependency_ordering_with_extra_fields(self):
     ir = _find_dependencies_for_snippet("struct Foo:\n"
                                         "  d [+4]   UInt  a\n"
                                         "  4 [+4]   UInt  b\n"
                                         "  8 [+4]   UInt  c\n"
                                         "  12 [+4]  UInt  d\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([1, 2, 3, 0], struct.fields_in_dependency_order[:4])
Exemplo n.º 6
0
 def test_dependency_ordering_with_local_parameter(self):
     ir = _find_dependencies_for_snippet("struct Foo(x: Int:13):\n"
                                         "  0 [+x]  Int  b\n")
     self.assertEqual([], dependency_checker.set_dependency_order(ir))
     struct = ir.module[0].type[0].structure
     self.assertEqual([0], struct.fields_in_dependency_order[:1])