@Test public void mark() throws Exception { CompatibilityMatrix m = new CompatibilityMatrix(5, 5); m.set(0, 1); m.set(0, 2); m.set(0, 4); m.set(1, 0); m.set(1, 3); assertTrue(m.get(0, 1)); assertTrue(m.get(0, 4)); m.mark(0, 1, -1); m.mark(0, 4, -4); m.mark(1, 3, -6); assertFalse(m.get(0, 1)); assertFalse(m.get(0, 4)); assertFalse(m.get(1, 3)); m.resetRows(0, -1); assertTrue(m.get(0, 1)); assertFalse(m.get(0, 4)); assertFalse(m.get(1, 3)); m.resetRows(0, -4); assertTrue(m.get(0, 1)); assertTrue(m.get(0, 4)); assertFalse(m.get(1, 3)); m.resetRows(0, -6); assertTrue(m.get(0, 1)); assertTrue(m.get(0, 4)); assertTrue(m.get(1, 3)); }
@Test public void markRow() throws Exception { CompatibilityMatrix m = new CompatibilityMatrix(5, 5); m.set(0, 1); m.set(0, 2); m.set(0, 4); assertThat(m.fix()[0], is(new int[] {0, 1, 1, 0, 1})); m.markRow(0, -1); assertThat(m.fix()[0], is(new int[] {0, -1, -1, 0, -1})); }
@Test public void accessAndModify() throws Exception { CompatibilityMatrix m = new CompatibilityMatrix(5, 5); assertFalse(m.get(0, 1)); assertFalse(m.get(0, 4)); assertFalse(m.get(1, 0)); assertFalse(m.get(1, 3)); m.set(0, 1); m.set(0, 4); m.set(1, 0); m.set(1, 3); assertTrue(m.get(0, 1)); assertTrue(m.get(0, 4)); assertTrue(m.get(1, 0)); assertTrue(m.get(1, 3)); }
@Test public void fix() throws Exception { CompatibilityMatrix m = new CompatibilityMatrix(5, 5); m.set(0, 1); m.set(0, 2); m.set(0, 4); m.set(1, 0); m.set(1, 3); m.set(2, 4); assertThat( m.fix(), is( new int[][] { {0, 1, 1, 0, 1}, {1, 0, 0, 1, 0}, {0, 0, 0, 0, 1}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, })); }