From 7fa6a29814dbd0a54590666bd7ab27e63d4acb0a Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Sat, 9 Aug 2003 20:57:04 +0000 Subject: [PATCH] no message [SVN r19498] --- pyste/tests/inherit3.h | 38 ++++++++++++++++++++++++++++++++++++++ pyste/tests/inherit3.pyste | 2 ++ pyste/tests/inherit3UT.py | 19 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 pyste/tests/inherit3.h create mode 100644 pyste/tests/inherit3.pyste create mode 100644 pyste/tests/inherit3UT.py 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()