}
}
@Test
public void testDoubleValue() {
DoubleValue double0 = new DoubleValue(10.2);
// test value retrieval
Assert.assertEquals(10.2, double0.getValue(), 0.0001);
// test value comparison
DoubleValue double1 = new DoubleValue(10.2);
DoubleValue double2 = new DoubleValue(-10.5);
DoubleValue double3 = new DoubleValue(20.2);
Assert.assertEquals(double0.compareTo(double0), 0);
Assert.assertEquals(double0.compareTo(double1), 0);
Assert.assertEquals(double0.compareTo(double2), 1);
Assert.assertEquals(double0.compareTo(double3), -1);
// test stream output and retrieval
try {
double0.write(new OutputViewDataOutputStreamWrapper(mOut));
double2.write(new OutputViewDataOutputStreamWrapper(mOut));
double3.write(new OutputViewDataOutputStreamWrapper(mOut));
DoubleValue double1n = new DoubleValue();
DoubleValue double2n = new DoubleValue();
DoubleValue double3n = new DoubleValue();
double1n.read(new InputViewDataInputStreamWrapper(mIn));
double2n.read(new InputViewDataInputStreamWrapper(mIn));
double3n.read(new InputViewDataInputStreamWrapper(mIn));
Assert.assertEquals(double0.compareTo(double1n), 0);
Assert.assertEquals(double0.getValue(), double1n.getValue(), 0.0001);
Assert.assertEquals(double2.compareTo(double2n), 0);
Assert.assertEquals(double2.getValue(), double2n.getValue(), 0.0001);
Assert.assertEquals(double3.compareTo(double3n), 0);
Assert.assertEquals(double3.getValue(), double3n.getValue(), 0.0001);
} catch (Exception e) {
Assert.assertTrue(false);
}
}