()
| 10712 | testList.append(("Buffer protocol test", testBufferProtocol)) |
| 10713 | |
| 10714 | def testFloatArray2D(): |
| 10715 | |
| 10716 | a = FloatArray2D(2,3) |
| 10717 | a[(0,0)] = 1.0 |
| 10718 | a[(0,1)] = 2.0 |
| 10719 | a[(0,2)] = 3.0 |
| 10720 | a[(1,0)] = 4.0 |
| 10721 | a[(1,1)] = 5.0 |
| 10722 | a[(1,2)] = 6.0 |
| 10723 | |
| 10724 | a += 1.0 |
| 10725 | a -= 0.5 |
| 10726 | a *= 4.0 |
| 10727 | a /= 2.0 |
| 10728 | b = 3 * a - a + (a * a / 2) / a |
| 10729 | |
| 10730 | assert equalWithAbsError (b.item(0,0), 7.5, 0.001) |
| 10731 | assert equalWithAbsError (b.item(0,1), 12.5, 0.001) |
| 10732 | assert equalWithAbsError (b.item(0,2), 17.5, 0.001) |
| 10733 | assert equalWithAbsError (b.item(1,0), 22.5, 0.001) |
| 10734 | assert equalWithAbsError (b.item(1,1), 27.5, 0.001) |
| 10735 | assert equalWithAbsError (b.item(1,2), 32.5, 0.001) |
| 10736 | |
| 10737 | choice = IntArray2D(2,3) |
| 10738 | choice[(0,0)] = 1 |
| 10739 | choice[(0,1)] = 0 |
| 10740 | choice[(0,2)] = 0 |
| 10741 | choice[(1,0)] = 0 |
| 10742 | choice[(1,1)] = 1 |
| 10743 | choice[(1,2)] = 0 |
| 10744 | |
| 10745 | d = b.ifelse(choice,a) |
| 10746 | |
| 10747 | assert d.item(0,0) == b.item(0,0) |
| 10748 | assert d.item(0,1) == a.item(0,1) |
| 10749 | assert d.item(0,2) == a.item(0,2) |
| 10750 | assert d.item(1,0) == a.item(1,0) |
| 10751 | assert d.item(1,1) == b.item(1,1) |
| 10752 | assert d.item(1,2) == a.item(1,2) |
| 10753 | |
| 10754 | print ("ok") |
| 10755 | |
| 10756 | testList.append(("FloatArray2D test", testFloatArray2D)) |
| 10757 |
nothing calls this directly
no test coverage detected