Test of writeData method, of class JSATData.
()
| 159 | * Test of writeData method, of class JSATData. |
| 160 | */ |
| 161 | @Test |
| 162 | public void testReadWriteSimple() throws Exception |
| 163 | { |
| 164 | System.out.println("ReadWriteSimple"); |
| 165 | |
| 166 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 167 | JSATData.writeData(simpleData, baos); |
| 168 | |
| 169 | ByteArrayInputStream bin = new ByteArrayInputStream(baos.toByteArray()); |
| 170 | |
| 171 | DataSet readBack = JSATData.load(bin); |
| 172 | |
| 173 | checkDataSet(simpleData, readBack); |
| 174 | |
| 175 | simpleData.applyTransform(new DenseSparceTransform(0.5));//sparcify our numeric values and try again |
| 176 | |
| 177 | baos = new ByteArrayOutputStream(); |
| 178 | JSATData.writeData(simpleData, baos); |
| 179 | |
| 180 | byte[] raw_read_back = baos.toByteArray(); |
| 181 | bin = new ByteArrayInputStream(raw_read_back); |
| 182 | |
| 183 | readBack = JSATData.load(bin); |
| 184 | |
| 185 | checkDataSet(simpleData, readBack); |
| 186 | |
| 187 | //what if we muck the number of data points to be a negative value? indicates streaming write scenario |
| 188 | raw_read_back[17] = -1; |
| 189 | raw_read_back[18] = -1; |
| 190 | raw_read_back[19] = -1; |
| 191 | raw_read_back[20] = -1; |
| 192 | bin = new ByteArrayInputStream(raw_read_back); |
| 193 | |
| 194 | readBack = JSATData.load(bin); |
| 195 | |
| 196 | checkDataSet(simpleData, readBack); |
| 197 | } |
| 198 | |
| 199 | @Test |
| 200 | public void testReadWriteClassification() throws Exception |
nothing calls this directly
no test coverage detected