MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testSwap

Method testSwap

JSAT/test/jsat/utils/IndexTableTest.java:114–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112 }
113
114 @Test
115 public void testSwap()
116 {
117 System.out.println("swap");
118 int i = 0;
119 int j = 1;
120 IndexTable idx = new IndexTable(array);
121 double di = array[idx.index(i)];
122 double dj = array[idx.index(j)];
123 idx.swap(i, j);
124 assertTrue(di == array[idx.index(j)]);
125 assertTrue(dj == array[idx.index(i)]);
126 assertTrue(di != dj);
127 idx.swap(j, i);
128 assertTrue(di != array[idx.index(j)]);
129 assertTrue(dj != array[idx.index(i)]);
130 assertTrue(di == array[idx.index(i)]);
131 assertTrue(dj == array[idx.index(j)]);
132
133 }
134}

Callers

nothing calls this directly

Calls 2

indexMethod · 0.95
swapMethod · 0.95

Tested by

no test coverage detected