예제 #1
0
 def test_cpp_output_private_access_const_return_method_in_class_in_namespace(self):
     cpp_namespace = CppNamespace("test", self.cpp_file)
     cpp_class = CppClass("Test", parent = cpp_namespace)
     cpp_method = CppMethod("test1", [], "int", cpp_class)
     cpp_method.const_return_type = True
     cpp_class.add_method(cpp_method, "private")
     cpp_namespace.add_class(cpp_class)
     self.cpp_file.add_namespace(cpp_namespace)
     self.assertEquals("\n\nnamespace test\n{\n\n// private\n\nconst int Test::test1()\n{\n\n}\n\n}\n\n", self.cpp_file.cpp())
예제 #2
0
 def test_header_output_static_return_method_in_class_in_namespace(self):
     cpp_namespace = CppNamespace("test", self.cpp_file)
     cpp_class = CppClass("Test", parent=cpp_namespace)
     cpp_method = CppMethod("test1", [], "int", cpp_class)
     cpp_method.static = True
     cpp_class.add_method(cpp_method, "private")
     cpp_namespace.add_class(cpp_class)
     self.cpp_file.add_namespace(cpp_namespace)
     self.assertEquals(
         "\n\nnamespace test\n{\n\nclass Test\n{\n\nprivate:\n\n    static int test1();\n\n};\n\n}\n\n",
         self.cpp_file.header(),
     )
예제 #3
0
 def test_header_output_template_method_in_class_in_namespace(self):
     cpp_namespace = CppNamespace("test", self.cpp_file)
     cpp_class = CppClass("Test1", parent=cpp_namespace)
     cpp_method = CppMethod("test1", [], "Test&", cpp_class)
     cpp_method.templated = True
     cpp_method.template_type = "Test"
     cpp_class.add_method(cpp_method, "private")
     cpp_namespace.add_class(cpp_class)
     self.cpp_file.add_namespace(cpp_namespace)
     self.assertEquals(
         "\n\nnamespace test\n{\n\nclass Test1\n{\n\nprivate:\n\n    template <class Test>\n    Test& test1();\n\n};\n\n}\n\n",
         self.cpp_file.header(),
     )