()
| 10756 | testList.append(("FloatArray2D test", testFloatArray2D)) |
| 10757 | |
| 10758 | def testColor4Array2D(): |
| 10759 | |
| 10760 | a = Color4fArray2D(2,3) |
| 10761 | a[(0,0)] = Color4f(1,0,0,0) |
| 10762 | a[(0,1)] = Color4f(0,1,0,0) |
| 10763 | a[(0,2)] = Color4f(0,0,1,0) |
| 10764 | a[(1,0)] = Color4f(1,0,0,1) |
| 10765 | a[(1,1)] = Color4f(0,1,0,1) |
| 10766 | a[(1,2)] = Color4f(0,0,1,1) |
| 10767 | |
| 10768 | a += Color4f(1.0, 1.0, 1.0, 1.0) |
| 10769 | a -= Color4f(0.5, 0.5, 0.5, 0.5) |
| 10770 | a *= 4.0 |
| 10771 | a /= 2.0 |
| 10772 | b = 3 * a - a + (a * a / 2) / a |
| 10773 | |
| 10774 | assert equalWithAbsError (b.item(0,0), Color4f(7.5, 2.5, 2.5, 2.5), 0.001) |
| 10775 | assert equalWithAbsError (b.item(0,1), Color4f(2.5, 7.5, 2.5, 2.5), 0.001) |
| 10776 | assert equalWithAbsError (b.item(0,2), Color4f(2.5, 2.5, 7.5, 2.5), 0.001) |
| 10777 | assert equalWithAbsError (b.item(1,0), Color4f(7.5, 2.5, 2.5, 7.5), 0.001) |
| 10778 | assert equalWithAbsError (b.item(1,1), Color4f(2.5, 7.5, 2.5, 7.5), 0.001) |
| 10779 | assert equalWithAbsError (b.item(1,2), Color4f(2.5, 2.5, 7.5, 7.5), 0.001) |
| 10780 | |
| 10781 | choice = IntArray2D(2,3) |
| 10782 | choice[(0,0)] = 1 |
| 10783 | choice[(0,1)] = 0 |
| 10784 | choice[(0,2)] = 0 |
| 10785 | choice[(1,0)] = 0 |
| 10786 | choice[(1,1)] = 1 |
| 10787 | choice[(1,2)] = 0 |
| 10788 | |
| 10789 | d = b.ifelse(choice,a) |
| 10790 | |
| 10791 | assert d.item(0,0) == b.item(0,0) |
| 10792 | assert d.item(0,1) == a.item(0,1) |
| 10793 | assert d.item(0,2) == a.item(0,2) |
| 10794 | assert d.item(1,0) == a.item(1,0) |
| 10795 | assert d.item(1,1) == b.item(1,1) |
| 10796 | assert d.item(1,2) == a.item(1,2) |
| 10797 | |
| 10798 | print ("ok") |
| 10799 | |
| 10800 | testList.append(("Color4fArray2D test", testColor4Array2D)) |
| 10801 |
nothing calls this directly
no test coverage detected