Пример #1
0
 def test_string_variable_declaration(self):
     self.assertEqual(
         self.parse("int main(void) { const char* foo = \"foo\"; }"),
         self.function_wrap_node(
             VariableDeclaration(name="foo",
                                 vtype=Type(base="pointer",
                                            const=True,
                                            reference=Type(base="char")),
                                 value=String("foo"))))
Пример #2
0
 def test_short_variable_declaration(self):
     self.assertEqual(
         self.parse(self.function_wrap('short i;')),
         self.function_wrap_node(
             VariableDeclaration(name="i",
                                 vtype=Type(base="short"),
                                 value=None)))
     var = Type(base="short")
     self.assertEqual(var.base_type, "int")
     self.assertEqual(var.length, 16)