|
| 1 | +package vecmatlib.color; |
| 2 | + |
| 3 | +import org.junit.Assert; |
| 4 | +import org.junit.Test; |
| 5 | + |
| 6 | +public class TestColor { |
| 7 | + |
| 8 | + @Test |
| 9 | + public void testSumValues() { |
| 10 | + Color c = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 11 | + Assert.assertEquals(c.$plus(0.5f, 0.6f, 0.7f, 0.5f), c.add(0.5f, 0.6f, 0.7f, 0.5f)); |
| 12 | + } |
| 13 | + |
| 14 | + @Test |
| 15 | + public void testSumColors() { |
| 16 | + Color c1 = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 17 | + Color c2 = new Color(0.5f, 0.6f, 0.7f, 0.5f); |
| 18 | + Assert.assertEquals(c1.$plus(c2), c1.add(c2)); |
| 19 | + } |
| 20 | + |
| 21 | + @Test |
| 22 | + public void testSubtractValues() { |
| 23 | + Color c = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 24 | + Assert.assertEquals(c.$minus(0.5f, 0.6f, 0.7f, 0.5f), c.subtract(0.5f, 0.6f, 0.7f, 0.5f)); |
| 25 | + } |
| 26 | + |
| 27 | + @Test |
| 28 | + public void testSubtractColors() { |
| 29 | + Color c1 = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 30 | + Color c2 = new Color(0.5f, 0.6f, 0.7f, 0.5f); |
| 31 | + Assert.assertEquals(c1.$minus(c2), c1.subtract(c2)); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void testMultiplyValues() { |
| 36 | + Color c = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 37 | + Assert.assertEquals(c.$times(0.5f, 0.6f, 0.7f, 0.5f), c.blend(0.5f, 0.6f, 0.7f, 0.5f)); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void testMultiplyColors() { |
| 42 | + Color c1 = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 43 | + Color c2 = new Color(0.5f, 0.6f, 0.7f, 0.5f); |
| 44 | + Assert.assertEquals(c1.$times(c2), c1.blend(c2)); |
| 45 | + } |
| 46 | + |
| 47 | + @Test |
| 48 | + public void testMultiplyScalar() { |
| 49 | + Color c = new Color(0.1f, 0.2f, 0.3f, 0.5f); |
| 50 | + Assert.assertEquals(c.$times(1.5f), c.multiply(1.5f)); |
| 51 | + } |
| 52 | +} |
0 commit comments