diff --git a/pyste/tests/inherit3.h b/pyste/tests/inherit3.h new file mode 100644 index 00000000..d296b5cf --- /dev/null +++ b/pyste/tests/inherit3.h @@ -0,0 +1,38 @@ + +namespace inherit3 { + +struct A +{ + struct X { int y; }; + int x; + int foo() { return 1; } + A operator+(A o) const + { + A r; + r.x = o.x + x; + return r; + } + enum E { i, j }; + +}; + +struct B: A +{ + struct X { int y; }; + int x; + int foo() { return 1; } + A operator+(A o) const + { + A r; + r.x = o.x + x; + return r; + } + enum E { i, j }; + +}; + +struct C: A +{ +}; + +} diff --git a/pyste/tests/inherit3.pyste b/pyste/tests/inherit3.pyste new file mode 100644 index 00000000..f95c0605 --- /dev/null +++ b/pyste/tests/inherit3.pyste @@ -0,0 +1,2 @@ +Class('inherit3::B', 'inherit3.h') +Class('inherit3::C', 'inherit3.h') diff --git a/pyste/tests/inherit3UT.py b/pyste/tests/inherit3UT.py new file mode 100644 index 00000000..53b9a947 --- /dev/null +++ b/pyste/tests/inherit3UT.py @@ -0,0 +1,19 @@ +import unittest +from _inherit3 import * + +class testInherit3(unittest.TestCase): + + def testIt(self): + def testClass(class_): + c = class_() + self.assertEqual(c.x, 0) + self.assertEqual(c.foo(), 1) + x = class_.X() + self.assertEqual(x.y, 0) + self.assertEqual(class_.E.i, 0) + self.assertEqual(class_.E.j, 1) + testClass(B) + testClass(C) + +if __name__ == '__main__': + unittest.main()