()
| 123 | } |
| 124 | |
| 125 | @Test |
| 126 | public void testBytesToDouble() throws IOException |
| 127 | { |
| 128 | // valid doubles |
| 129 | String[] a = {"1", "-2.345", "12.12334567890123456", "1.02e12","-.23344", ""}; |
| 130 | Double[] d = {1.0, -2.345, 12.12334567890123456, 1.02e12, -.23344}; |
| 131 | for (int j = 0; j < d.length; j++) { |
| 132 | byte[] b = a[j].getBytes(); |
| 133 | assertEquals(d[j], ps.getLoadCaster().bytesToDouble(b)); |
| 134 | } |
| 135 | |
| 136 | // invalid doubles |
| 137 | a = new String[]{"-0x1.1", "-23a.45", "This is a double", "", " "}; |
| 138 | for (String s : a) { |
| 139 | byte[] b = s.getBytes(); |
| 140 | Double dl = ps.getLoadCaster().bytesToDouble(b); |
| 141 | assertNull(dl); |
| 142 | |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | @Test |
| 147 | public void testBytesToLong() throws IOException |
nothing calls this directly
no test coverage detected