コード例 #1
0
ファイル: testparam.py プロジェクト: asdf1011/bdec
 def test_sequence_value(self):
     a = Field('a:', 8, Field.INTEGER)
     b = Sequence('b', [a], parse('${a:}'))
     lookup = ResultParameters([b])
     self.assertEqual([], lookup.get_params(a))
     self.assertEqual([Param('result', Param.OUT, EntryType(b))],
             lookup.get_params(b))
     self.assertEqual([], lookup.get_locals(a))
     self.assertEqual([], lookup.get_locals(b))
     self.assertEqual([], lookup.get_passed_variables(b, b.children[0]))
コード例 #2
0
ファイル: testparam.py プロジェクト: asdf1011/bdec
 def test_visible_common_in_hidden_context(self):
     a = Field('a', 8)
     b = Sequence('b:', [a])
     lookup = ResultParameters([a, b])
     self.assertEqual([Param('result', Param.OUT, EntryType(a))],
             lookup.get_params(a))
     self.assertEqual([], lookup.get_params(b))
     self.assertEqual([Local('unused a', EntryType(a))], lookup.get_locals(b))
     self.assertEqual([Param('unused a', Param.OUT, EntryType(a))],
         lookup.get_passed_variables(b, b.children[0]))
コード例 #3
0
ファイル: testparam.py プロジェクト: asdf1011/bdec
 def test_hidden_reference(self):
     # Test a visible common reference that is hidden through its reference
     # name. This is common for integers defined at the common level.
     #
     # Note that in this case 'b' won't have an output, because all of the
     # fields it defines are hidden, and so doesn't have a type itself.
     a = Field('a', 8, Field.INTEGER)
     b = Sequence('b', [Child('a:', a)])
     lookup = ResultParameters([a, b])
     self.assertEqual([Param('result', Param.OUT, EntryType(a))], lookup.get_params(a))
     self.assertEqual([], lookup.get_params(b))
     self.assertEqual([Local('unused a:', EntryType(a))], lookup.get_locals(b))
     self.assertEqual([Param('unused a:', Param.OUT, EntryType(a))], lookup.get_passed_variables(b, b.children[0]))