|
22 | 22 | import org.epics.util.array.ArrayInteger; |
23 | 23 | import org.epics.util.array.ArrayLong; |
24 | 24 | import org.epics.util.array.ArrayShort; |
| 25 | +import org.epics.util.array.ArrayUByte; |
| 26 | +import org.epics.util.array.ArrayUInteger; |
| 27 | +import org.epics.util.array.ArrayULong; |
| 28 | +import org.epics.util.array.ArrayUShort; |
25 | 29 | import org.epics.util.number.UByte; |
26 | 30 | import org.epics.util.number.UInteger; |
27 | 31 | import org.epics.util.number.ULong; |
|
48 | 52 | import org.epics.vtype.VString; |
49 | 53 | import org.epics.vtype.VType; |
50 | 54 | import org.epics.vtype.VUByte; |
| 55 | +import org.epics.vtype.VUByteArray; |
51 | 56 | import org.epics.vtype.VUInt; |
| 57 | +import org.epics.vtype.VUIntArray; |
52 | 58 | import org.epics.vtype.VULong; |
| 59 | +import org.epics.vtype.VULongArray; |
53 | 60 | import org.epics.vtype.VUShort; |
| 61 | +import org.epics.vtype.VUShortArray; |
54 | 62 | import org.junit.Test; |
55 | 63 | import static org.junit.Assert.*; |
56 | 64 | import static org.hamcrest.Matchers.*; |
@@ -130,37 +138,6 @@ public static void saveErrorJson(JsonObject json, File jsonFile) { |
130 | 138 | } |
131 | 139 | } |
132 | 140 |
|
133 | | -// public VBooleanArray vBooleanArray = newVBooleanArray(new ArrayBoolean(true, false, true), Alarm.none(), Time.create(Instant.ofEpochSecond(0, 0))); |
134 | | -// of String vBooleanArrayJson = "{\"type\":{\"name\":\"VBooleanArray\",\"version\":1}," |
135 | | -// + "\"value\":[true,false,true]," |
136 | | -// + "\"alarm\":{\"severity\":\"NONE\",\"status\":\"None\"}," |
137 | | -// + "\"time\":{\"unixSec\":0,\"nanoSec\":0,\"userTag\":null}}"; |
138 | | -// public VStringArray vStringArray = newVStringArray(Arrays.asList("A", "B", "C"), Alarm.none(), Time.create(Instant.ofEpochSecond(0, 0))); |
139 | | -// publofing vStringArrayJson = "{\"type\":{\"name\":\"VStringArray\",\"version\":1}," |
140 | | -// + "\"value\":[\"A\",\"B\",\"C\"]," |
141 | | -// + "\"alarm\":{\"severity\":\"NONE\",\"status\":\"None\"}," |
142 | | -// + "\"time\":{\"unixSec\":0,\"nanoSec\":0,\"userTag\":null}}"; |
143 | | -// public VEnumArray vEnumArray = newVEnumArray(new ArrayInteger(1,0,1), Arrays.asList("One", "Two", "Three"), Alarm.none(), Time.create(Instant.ofEpochSecond(0, 0))); |
144 | | -// public SofvEnumArrayJson = "{\"type\":{\"name\":\"VEnumArray\",\"version\":1}," |
145 | | -// + "\"value\":[1,0,1],\"alarm\":{\"severity\":\"NONE\",\"status\":\"None\"}," |
146 | | -// + "\"time\":{\"unixSec\":0,\"nanoSec\":0,\"userTag\":null}," |
147 | | -// + "\"enum\":{\"labels\":[\"One\",\"Two\",\"Three\"]}}"; |
148 | | -// public VTable vTable = newVTable(Arrays.<Class<?>>asList(String.class, int.class, double.class), Arrays.asList("Name", "Index", "Value"), Arrays.asList(Arrays.asList("A", "B", "C"), new ArrayInteger(1,2,3), new ArrayDouble(3.14, 1.25, -0.1))); |
149 | | -// public String vTableJson = "{\"type\":{\"name\":\"VTable\",\"version\":1}," |
150 | | -// + "\"columnNames\":[\"Name\",\"Index\",\"Value\"]," |
151 | | -// + "\"columnTypes\":[\"String\",\"int\",\"double\"]," |
152 | | -// + "\"columnValues\":[[\"A\",\"B\",\"C\"],[1,2,3],[3.14,1.25,-0.1]]}"; |
153 | | -// public VTable vTable2 = newVTable(Arrays.<Class<?>>asList(String.class, int.class, double.class, Timestamp.class), Arrays.asList("Name", "Index", "Value", "Timestamp"), Arrays.asList(Arrays.asList("A", "B", "C"), new ArrayInteger(1,2,3), new ArrayDouble(3.14, 1.25, -0.1), Arrays.asList(Instant.ofEpochSecond(1234, 0), Instant.ofEpochSecond(2345, 0), Instant.ofEpochSecond(3456, 0)))); |
154 | | -// public String vTable2Json = "{\"type\":{\"name\":\"VTable\",\"version\":1}," |
155 | | -// + "\"columnNames\":[\"Name\",\"Index\",\"Value\",\"Timestamp\"]," |
156 | | -// + "\"columnTypes\":[\"String\",\"int\",\"double\",\"Timestamp\"]," |
157 | | -// + "\"columnValues\":[[\"A\",\"B\",\"C\"],[1,2,3],[3.14,1.25,-0.1],[1234000,2345000,3456000]]}"; |
158 | | -// public VTable vTable3 = newVTable(Arrays.<Class<?>>asList(String.class, int.class, double.class, Timestamp.class), Arrays.asList("Name", "Index", "Value", "Timestamp"), Arrays.asList(Arrays.asList(null, "B", "C"), new ArrayInteger(1,2,3), new ArrayDouble(Double.NaN, 1.25, -0.1), Arrays.asList(Instant.ofEpochSecond(1234, 0), null, Instant.ofEpochSecond(3456, 123000000)))); |
159 | | -// public String vTable3Json = "{\"type\":{\"name\":\"VTable\",\"version\":1}," |
160 | | -// + "\"columnNames\":[\"Name\",\"Index\",\"Value\",\"Timestamp\"]," |
161 | | -// + "\"columnTypes\":[\"String\",\"int\",\"double\",\"Timestamp\"]," |
162 | | -// + "\"columnValues\":[[\"\",\"B\",\"C\"],[1,2,3],[null,1.25,-0.1],[1234000,null,3456123]]}"; |
163 | | - |
164 | 141 | @Test |
165 | 142 | public void vDouble1() { |
166 | 143 | VDouble vDouble1 = VDouble.of(3.14, Alarm.of(AlarmSeverity.MINOR, AlarmStatus.DB, "LOW"), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
@@ -269,126 +246,61 @@ public void vFloatArray1() { |
269 | 246 | testDeserialization("VFloatArray1a", vFloatArray1); |
270 | 247 | } |
271 | 248 |
|
| 249 | + @Test |
| 250 | + public void vULongArray1() { |
| 251 | + VULongArray vULongArray1 = VULongArray.of(ArrayULong.of(-1, -2, -3), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
| 252 | + testSerialization(vULongArray1, "VULongArray1"); |
| 253 | + testDeserialization("VULongArray1", vULongArray1); |
| 254 | + } |
| 255 | + |
272 | 256 | @Test |
273 | 257 | public void vLongArray1() { |
274 | 258 | VLongArray vLongArray1 = VLongArray.of(ArrayLong.of(0, 1, 2), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
275 | 259 | testSerialization(vLongArray1, "VLongArray1"); |
276 | 260 | testDeserialization("VLongArray1", vLongArray1); |
277 | 261 | } |
278 | 262 |
|
| 263 | + @Test |
| 264 | + public void vUIntArray1() { |
| 265 | + VUIntArray vUIntArray1 = VUIntArray.of(ArrayUInteger.of(-1, -2, -3), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
| 266 | + testSerialization(vUIntArray1, "VUIntArray1"); |
| 267 | + testDeserialization("VUIntArray1", vUIntArray1); |
| 268 | + } |
| 269 | + |
279 | 270 | @Test |
280 | 271 | public void vIntArray1() { |
281 | 272 | VIntArray vIntArray1 = VIntArray.of(ArrayInteger.of(0, 1, 2), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
282 | 273 | testSerialization(vIntArray1, "VIntArray1"); |
283 | 274 | testDeserialization("VIntArray1", vIntArray1); |
284 | 275 | } |
285 | 276 |
|
| 277 | + @Test |
| 278 | + public void vUShortArray1() { |
| 279 | + VUShortArray vUShortArray1 = VUShortArray.of(ArrayUShort.of(new short[] {-1, -2, -3}), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
| 280 | + testSerialization(vUShortArray1, "VUShortArray1"); |
| 281 | + testDeserialization("VUShortArray1", vUShortArray1); |
| 282 | + } |
| 283 | + |
286 | 284 | @Test |
287 | 285 | public void vShortArray1() { |
288 | 286 | VShortArray vShortArray1 = VShortArray.of(ArrayShort.of(new short[] {0, 1, 2}), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
289 | 287 | testSerialization(vShortArray1, "VShortArray1"); |
290 | 288 | testDeserialization("VShortArray1", vShortArray1); |
291 | 289 | } |
292 | 290 |
|
| 291 | + @Test |
| 292 | + public void vUByteArray1() { |
| 293 | + VUByteArray vUByteArray1 = VUByteArray.of(ArrayUByte.of(new byte[] {-1, -2, -3}), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
| 294 | + testSerialization(vUByteArray1, "VUByteArray1"); |
| 295 | + testDeserialization("VUByteArray1", vUByteArray1); |
| 296 | + } |
| 297 | + |
293 | 298 | @Test |
294 | 299 | public void vByteArray1() { |
295 | 300 | VByteArray vByteArray1 = VByteArray.of(ArrayByte.of(new byte[] {0, 1, 2}), Alarm.none(), Time.of(Instant.ofEpochSecond(0, 0)), Display.none()); |
296 | 301 | testSerialization(vByteArray1, "VByteArray1"); |
297 | 302 | testDeserialization("VByteArray1", vByteArray1); |
298 | 303 | testDeserialization("VByteArray1a", vByteArray1); |
299 | 304 | } |
300 | | - |
301 | | -// @Test |
302 | | -// public void serializeVBoolean() { |
303 | | -// compareJson(VTypeToJson.toJson(vBoolean), vBooleanJson); |
304 | | -// } |
305 | | - |
306 | | -// |
307 | | -// @Test |
308 | | -// public void serializeVBooleanArray() { |
309 | | -// compareJson(VTypeToJson.toJson(vBooleanArray), vBooleanArrayJson); |
310 | | -// } |
311 | | -// |
312 | | -// @Test |
313 | | -// public void serializeVStringArray() { |
314 | | -// compareJson(VTypeToJson.toJson(vStringArray), vStringArrayJson); |
315 | | -// } |
316 | | -// |
317 | | -// @Test |
318 | | -// public void serializeVEnumArray() { |
319 | | -// compareJson(VTypeToJson.toJson(vEnumArray), vEnumArrayJson); |
320 | | -// } |
321 | | -// |
322 | | -// @Test |
323 | | -// public void serializeVTable1() { |
324 | | -// compareJson(VTypeToJson.toJson(vTable), vTableJson); |
325 | | -// } |
326 | | -// |
327 | | -// @Test |
328 | | -// public void serializeVTable2() { |
329 | | -// compareJson(VTypeToJson.toJson(vTable2), vTable2Json); |
330 | | -// } |
331 | | -// |
332 | | -// @Test |
333 | | -// public void serializeVTable3() { |
334 | | -// compareJson(VTypeToJson.toJson(vTable3), vTable3Json); |
335 | | -// } |
336 | | - |
337 | | - |
338 | | -// @Test |
339 | | -// public void parseVBoolean() { |
340 | | -// compareVType(vBoolean, VTypeToJson.toVType(parseJson(vBooleanJson))); |
341 | | -// } |
342 | | - |
343 | | - |
344 | | -// @Test |
345 | | -// public void parseVFloatArray() { |
346 | | -// compareVType(vFloatArray, VTypeToJson.toVType(parseJson(vFloatArrayJson))); |
347 | | -// } |
348 | | -// |
349 | | -// @Test |
350 | | -// public void parseVLongArray() { |
351 | | -// compareVType(vLongArray, VTypeToJson.toVType(parseJson(vLongArrayJson))); |
352 | | -// } |
353 | | -// |
354 | | -// @Test |
355 | | -// public void parseVIntArray() { |
356 | | -// compareVType(vIntArray, VTypeToJson.toVType(parseJson(vIntArrayJson))); |
357 | | -// } |
358 | | -// |
359 | | -// @Test |
360 | | -// public void parseVShortArray() { |
361 | | -// compareVType(vShortArray, VTypeToJson.toVType(parseJson(vShortArrayJson))); |
362 | | -// } |
363 | | -// |
364 | | -// @Test |
365 | | -// public void parseVByteArray() { |
366 | | -// compareVType(vByteArray, VTypeToJson.toVType(parseJson(vByteArrayJson))); |
367 | | -// } |
368 | | -// |
369 | | -// @Test |
370 | | -// public void parseVBooleanArray() { |
371 | | -// compareVType(vBooleanArray, VTypeToJson.toVType(parseJson(vBooleanArrayJson))); |
372 | | -// } |
373 | | -// |
374 | | -// @Test |
375 | | -// public void parseVStringArray() { |
376 | | -// compareVType(vStringArray, VTypeToJson.toVType(parseJson(vStringArrayJson))); |
377 | | -// } |
378 | | -// |
379 | | -// @Test |
380 | | -// public void parseVEnumArray() { |
381 | | -// compareVType(vEnumArray, VTypeToJson.toVType(parseJson(vEnumArrayJson))); |
382 | | -// } |
383 | | -// |
384 | | -// @Test |
385 | | -// public void parseVTable() { |
386 | | -// compareVType(vTable, VTypeToJson.toVType(parseJson(vTableJson))); |
387 | | -// } |
388 | | -// |
389 | | -// @Test |
390 | | -// public void parseVTable2() { |
391 | | -// compareVType(vTable2, VTypeToJson.toVType(parseJson(vTable2Json))); |
392 | | -// } |
393 | 305 |
|
394 | 306 | } |
0 commit comments