2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

no message

[SVN r19498]
This commit is contained in:
Bruno da Silva de Oliveira
2003-08-09 20:57:04 +00:00
parent f2b51da0ab
commit 7fa6a29814
3 changed files with 59 additions and 0 deletions

38
pyste/tests/inherit3.h Normal file
View File

@@ -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
{
};
}

View File

@@ -0,0 +1,2 @@
Class('inherit3::B', 'inherit3.h')
Class('inherit3::C', 'inherit3.h')

19
pyste/tests/inherit3UT.py Normal file
View File

@@ -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()