|
2 | 2 | from tests import test_module as tm |
3 | 3 |
|
4 | 4 |
|
5 | | -# def test_return_by_ref(): |
6 | | -# a = tm.ClassForReturn() |
7 | | -# assert(id(a.returnByRef()) == id(a.returnByRef())) |
| 5 | +def test_return_by_value(): |
| 6 | + a = tm.ClassForReturn() |
| 7 | + assert(id(a.returnByValue()) != id(a.returnByValue())) |
| 8 | + mat = a.returnByValue() |
| 9 | + a.changeInternal() |
| 10 | + assert(np.any(mat != a.returnByValue())) |
8 | 11 |
|
9 | | -# def test_return_by_value(): |
10 | | -# a = tm.ClassForReturn() |
11 | | -# assert(id(a.returnByValue()) != id(a.returnByValue())) |
12 | 12 |
|
13 | | -# def test_return_by_pointer(): |
14 | | -# a = tm.ClassForReturn() |
15 | | -# assert(id(a.returnByPointer()) == id(a.returnByPointer())) |
| 13 | +def test_return_by_ref_but_copy(): |
| 14 | + a = tm.ClassForReturn() |
| 15 | + assert(id(a.returnByRef()) != id(a.returnByRef())) |
| 16 | + mat = a.returnByRef() |
| 17 | + a.changeInternal() |
| 18 | + assert(np.any(mat != a.returnByValue())) |
16 | 19 |
|
17 | | -# def test_return_by_argument_by_ref(): |
18 | | -# pass |
19 | 20 |
|
20 | | -# def test_return_by_argument_by_value(): |
21 | | -# pass |
| 21 | +def test_return_by_ref(): |
| 22 | + a = tm.ClassForReturn() |
| 23 | + assert(id(a.returnByRef()) != id(a.returnByRef())) |
| 24 | + mat = a.viewMatrix() |
| 25 | + a.changeInternal() |
| 26 | + assert(np.all(mat == a.returnByValue())) |
22 | 27 |
|
23 | | -# def test_return_by_argument_by_pointer(): |
24 | | -# pass |
| 28 | + |
| 29 | +def test_return_by_pointer(): |
| 30 | + a = tm.ClassForReturn() |
| 31 | + assert(id(a.returnByPointer()) != id(a.returnByPointer())) |
| 32 | + mat = a.returnByPointer() |
| 33 | + a.changeInternal() |
| 34 | + assert(np.all(mat == a.returnByValue())) |
| 35 | + |
| 36 | + |
| 37 | +def test_return_by_argument_by_ref(): |
| 38 | + pass |
| 39 | + |
| 40 | +def test_return_by_argument_by_value(): |
| 41 | + pass |
| 42 | + |
| 43 | +def test_return_by_argument_by_pointer(): |
| 44 | + pass |
0 commit comments