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:
38
pyste/tests/inherit3.h
Normal file
38
pyste/tests/inherit3.h
Normal 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
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
2
pyste/tests/inherit3.pyste
Normal file
2
pyste/tests/inherit3.pyste
Normal file
@@ -0,0 +1,2 @@
|
||||
Class('inherit3::B', 'inherit3.h')
|
||||
Class('inherit3::C', 'inherit3.h')
|
||||
19
pyste/tests/inherit3UT.py
Normal file
19
pyste/tests/inherit3UT.py
Normal 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()
|
||||
Reference in New Issue
Block a user