DataPointImpl dp_real_number = new DataPointImpl(
EDataPointType.TYPE_REAL, CosDpValueTypeEnum.TypeNumber);
dp_real_number.keyId = 1;
dp_real_number.name = "real-number";
CosDpValueUnion out_bool_value = new CosDpValueUnion();
out_bool_value.boolValue(false);
CosDpValueUnion out_number_value = new CosDpValueUnion();
out_number_value.longValue(0);
CosDpValueUnion out_unsigned_value = new CosDpValueUnion();
out_unsigned_value.unsignedValue(0);
CosDpValueUnion out_double_value = new CosDpValueUnion();
out_double_value.dblValue(0.0);
CosDpValueUnion out_string_value = new CosDpValueUnion();
out_string_value.charValue("");
CosDpValueUnion in_bool_value = new CosDpValueUnion();
in_bool_value.boolValue(false);
CosDpValueUnion in_number_value = new CosDpValueUnion();
in_number_value.longValue(0);
CosDpValueUnion in_unsigned_value = new CosDpValueUnion();
in_unsigned_value.unsignedValue(0);
CosDpValueUnion in_double_value = new CosDpValueUnion();
in_double_value.dblValue(0.0);
CosDpValueUnion in_string_value = new CosDpValueUnion();
in_string_value.charValue("");
// BOOLEAN data type
// copy bool to bool (new value)
out_bool_value.boolValue(false);
in_bool_value.boolValue(true);
int status = dp_real_number._copy(out_bool_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertEquals(out_bool_value.boolValue(), in_bool_value
.boolValue());
// copy bool to bool (the same value)
out_bool_value.boolValue(false);
in_bool_value.boolValue(false);
status = dp_real_number._copy(out_bool_value, in_bool_value);
Assert.assertEquals(0, status);
Assert.assertEquals(out_bool_value.boolValue(), in_bool_value
.boolValue());
// copy number to bool (value = 0)
out_bool_value.boolValue(false);
in_number_value.longValue(0);
status = dp_real_number._copy(out_bool_value, in_number_value);
Assert.assertEquals(0, status);
Assert.assertEquals(false, out_bool_value.boolValue());
// copy number to bool (value = -1)
out_bool_value.boolValue(false);
in_number_value.longValue(-1);
status = dp_real_number._copy(out_bool_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy number to bool (value = +1)
out_bool_value.boolValue(false);
in_number_value.longValue(1);
status = dp_real_number._copy(out_bool_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy unsigned to bool (value = 0)
out_bool_value.boolValue(false);
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_bool_value, in_unsigned_value);
Assert.assertEquals(0, status);
Assert.assertEquals(false, out_bool_value.boolValue());
// copy unsigned to bool (value = +1)
out_bool_value.boolValue(false);
in_unsigned_value.unsignedValue(1);
status = dp_real_number._copy(out_bool_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy double to bool (value = 0)
out_bool_value.boolValue(false);
in_double_value.dblValue(0);
status = dp_real_number._copy(out_bool_value, in_double_value);
Assert.assertEquals(0, status);
Assert.assertEquals(false, out_bool_value.boolValue());
// copy double to bool (value = -1.5)
out_bool_value.boolValue(false);
in_double_value.dblValue(-1.5);
status = dp_real_number._copy(out_bool_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy double to bool (value = -1.5)
out_bool_value.boolValue(false);
in_double_value.dblValue(1.5);
status = dp_real_number._copy(out_bool_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy string to bool (value = "")
out_bool_value.boolValue(false);
in_string_value.charValue("");
status = dp_real_number._copy(out_bool_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(false, out_bool_value.boolValue());
// copy string to bool (value = "test")
out_bool_value.boolValue(false);
in_string_value.charValue("test");
status = dp_real_number._copy(out_bool_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(true, out_bool_value.boolValue());
// copy string to bool (value = null)
out_bool_value.boolValue(false);
in_string_value.charValue(null);
status = dp_real_number._copy(out_bool_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(false, out_bool_value.boolValue());
// NUMBER data type
// copy bool to number (value = true)
out_number_value.longValue(0);
in_bool_value.boolValue(true);
status = dp_real_number._copy(out_number_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertEquals(1, out_number_value.longValue());
// copy bool to number (value = false)
out_number_value.longValue(0);
in_bool_value.boolValue(false);
status = dp_real_number._copy(out_number_value, in_bool_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy number to number (value = 0, the same value)
out_number_value.longValue(0);
in_number_value.longValue(0);
status = dp_real_number._copy(out_number_value, in_number_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy number to number (value = 0, the different value)
out_number_value.longValue(1);
in_number_value.longValue(0);
status = dp_real_number._copy(out_number_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy number to number (value = -1)
out_number_value.longValue(0);
in_number_value.longValue(-11);
status = dp_real_number._copy(out_number_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11, out_number_value.longValue());
// copy number to number (value = +1)
out_number_value.longValue(0);
in_number_value.longValue(11);
status = dp_real_number._copy(out_number_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_number_value.longValue());
// copy unsigned to number (value = 0)
out_number_value.longValue(0);
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_number_value, in_unsigned_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy unsigned to number (value = +1)
out_number_value.longValue(0);
in_unsigned_value.unsignedValue(11);
status = dp_real_number._copy(out_number_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_number_value.longValue());
// copy double to number (value = 0)
out_number_value.longValue(0);
in_double_value.dblValue(0);
status = dp_real_number._copy(out_number_value, in_double_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy double to number (value = -11.5)
out_number_value.longValue(0);
in_double_value.dblValue(-11.5);
status = dp_real_number._copy(out_number_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11, out_number_value.longValue());
// copy double to number (value = 11.5)
out_number_value.longValue(0);
in_double_value.dblValue(11.5);
status = dp_real_number._copy(out_number_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_number_value.longValue());
// copy string to number (value = "")
out_number_value.longValue(0);
in_string_value.charValue("");
status = dp_real_number._copy(out_number_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy string to number (value = "test")
out_number_value.longValue(0);
in_string_value.charValue("test");
status = dp_real_number._copy(out_number_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// copy string to number (value = "11")
out_number_value.longValue(0);
in_string_value.charValue("11");
status = dp_real_number._copy(out_number_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_number_value.longValue());
// copy string to number (value = "-11")
out_number_value.longValue(0);
in_string_value.charValue("-11");
status = dp_real_number._copy(out_number_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11, out_number_value.longValue());
// copy string to number (value = null)
out_number_value.longValue(0);
in_string_value.charValue(null);
status = dp_real_number._copy(out_number_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_number_value.longValue());
// UNSIGNED data type
// copy bool to unsigned (value = true)
out_unsigned_value.unsignedValue(0);
in_bool_value.boolValue(true);
status = dp_real_number._copy(out_unsigned_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertEquals(1, out_unsigned_value.unsignedValue());
// copy bool to unsigned (value = false)
out_unsigned_value.unsignedValue(0);
in_bool_value.boolValue(false);
status = dp_real_number._copy(out_unsigned_value, in_bool_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy number to unsigned (value = 0)
out_unsigned_value.unsignedValue(0);
in_number_value.longValue(0);
status = dp_real_number._copy(out_unsigned_value, in_number_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy number to unsigned (value = -11)
out_unsigned_value.unsignedValue(0);
in_number_value.longValue(-11);
status = dp_real_number._copy(out_unsigned_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy number to unsigned (value = +11)
out_unsigned_value.unsignedValue(0);
in_number_value.longValue(11);
status = dp_real_number._copy(out_unsigned_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy unsigned to unsigned (value = 0, the same value)
out_unsigned_value.unsignedValue(0);
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_unsigned_value, in_unsigned_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy unsigned to unsigned (value = 0, the different value)
out_unsigned_value.unsignedValue(11);
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_unsigned_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy unsigned to unsigned (value = +11)
out_unsigned_value.unsignedValue(0);
in_unsigned_value.unsignedValue(11);
status = dp_real_number._copy(out_unsigned_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy double to unsigned (value = 0)
out_unsigned_value.unsignedValue(0);
in_double_value.dblValue(0);
status = dp_real_number._copy(out_unsigned_value, in_double_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy double to unsigned (value = -11.5)
out_unsigned_value.unsignedValue(0);
in_double_value.dblValue(-11.5);
status = dp_real_number._copy(out_unsigned_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy double to unsigned (value = 11.5)
out_unsigned_value.unsignedValue(0);
in_double_value.dblValue(11.5);
status = dp_real_number._copy(out_unsigned_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy string to unsigned (value = "")
out_unsigned_value.unsignedValue(0);
in_string_value.charValue("");
status = dp_real_number._copy(out_unsigned_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy string to unsigned (value = "test")
out_unsigned_value.unsignedValue(0);
in_string_value.charValue("test");
status = dp_real_number._copy(out_unsigned_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// copy string to unsigned (value = "11")
out_unsigned_value.unsignedValue(0);
in_string_value.charValue("11");
status = dp_real_number._copy(out_unsigned_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy string to unsigned (value = "-11")
out_unsigned_value.unsignedValue(0);
in_string_value.charValue("-11");
status = dp_real_number._copy(out_unsigned_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11, out_unsigned_value.unsignedValue());
// copy string to unsigned (value = null)
out_unsigned_value.unsignedValue(0);
in_string_value.charValue(null);
status = dp_real_number._copy(out_unsigned_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0, out_unsigned_value.unsignedValue());
// DOUBLE data type
// copy bool to double (value = true)
out_double_value.dblValue(0);
in_bool_value.boolValue(true);
status = dp_real_number._copy(out_double_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertEquals(1.0, out_double_value.dblValue());
// copy bool to double (value = false)
out_double_value.dblValue(0);
in_bool_value.boolValue(false);
status = dp_real_number._copy(out_double_value, in_bool_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy number to double (value = 0)
out_double_value.dblValue(0);
in_number_value.longValue(0);
status = dp_real_number._copy(out_double_value, in_number_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy number to double (value = -11)
out_double_value.dblValue(0);
in_number_value.longValue(-11);
status = dp_real_number._copy(out_double_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11.0, out_double_value.dblValue());
// copy number to double (value = +11)
out_double_value.dblValue(0);
in_number_value.longValue(11);
status = dp_real_number._copy(out_double_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11.0, out_double_value.dblValue());
// copy unsigned to double (value = 0, the same value)
out_double_value.dblValue(0);
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_double_value, in_unsigned_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy unsigned to double (value = +11)
out_double_value.dblValue(0);
in_unsigned_value.unsignedValue(11);
status = dp_real_number._copy(out_double_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11.0, out_double_value.dblValue());
// copy double to double (value = 0, the same value)
out_double_value.dblValue(0);
in_double_value.dblValue(0);
status = dp_real_number._copy(out_double_value, in_double_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy double to double (value = 0, different value)
out_double_value.dblValue(11);
in_double_value.dblValue(0);
status = dp_real_number._copy(out_double_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy double to double (value = -11.5)
out_double_value.dblValue(0);
in_double_value.dblValue(-11.5);
status = dp_real_number._copy(out_double_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11.5, out_double_value.dblValue());
// copy double to double (value = 11.5)
out_double_value.dblValue(0);
in_double_value.dblValue(11.5);
status = dp_real_number._copy(out_double_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11.5, out_double_value.dblValue());
// copy string to double (value = "")
out_double_value.dblValue(0);
in_string_value.charValue("");
status = dp_real_number._copy(out_double_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy string to double (value = "test")
out_double_value.dblValue(0);
in_string_value.charValue("test");
status = dp_real_number._copy(out_double_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// copy string to double (value = "11.5")
out_double_value.dblValue(0);
in_string_value.charValue("11.5");
status = dp_real_number._copy(out_double_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(11.5, out_double_value.dblValue());
// copy string to double (value = "-11.5")
out_double_value.dblValue(0);
in_string_value.charValue("-11.5");
status = dp_real_number._copy(out_double_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertEquals(-11.5, out_double_value.dblValue());
// copy string to double (value = null)
out_double_value.dblValue(0);
in_string_value.charValue(null);
status = dp_real_number._copy(out_double_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertEquals(0.0, out_double_value.dblValue());
// STRING data type
// copy bool to string (value = true)
out_string_value.charValue("");
in_bool_value.boolValue(true);
status = dp_real_number._copy(out_string_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareToIgnoreCase(
"true") == 0);
// copy bool to string (value = false)
out_string_value.charValue("");
in_bool_value.boolValue(false);
status = dp_real_number._copy(out_string_value, in_bool_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareToIgnoreCase(
"false") == 0);
// copy number to string (value = 0)
out_string_value.charValue("");
in_number_value.longValue(0);
status = dp_real_number._copy(out_string_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("0") == 0);
// copy number to string (value = -11)
out_string_value.charValue("");
in_number_value.longValue(-11);
status = dp_real_number._copy(out_string_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("-11") == 0);
// copy number to string (value = +11)
out_string_value.charValue("");
in_number_value.longValue(11);
status = dp_real_number._copy(out_string_value, in_number_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("11") == 0);
// copy unsigned to string (value = 0, the same value)
out_string_value.charValue("");
in_unsigned_value.unsignedValue(0);
status = dp_real_number._copy(out_string_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("0") == 0);
// copy unsigned to string (value = +11)
out_string_value.charValue("");
in_unsigned_value.unsignedValue(11);
status = dp_real_number._copy(out_string_value, in_unsigned_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("11") == 0);
// copy double to string (value = 0, the same value)
out_string_value.charValue("");
in_double_value.dblValue(0);
status = dp_real_number._copy(out_string_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("0.0") == 0);
// copy double to string (value = -11.5)
out_string_value.charValue("");
in_double_value.dblValue(-11.5);
status = dp_real_number._copy(out_string_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("-11.5") == 0);
// copy double to string (value = 11.5)
out_string_value.charValue("");
in_double_value.dblValue(11.5);
status = dp_real_number._copy(out_string_value, in_double_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("11.5") == 0);
// copy string to string (value = "")
out_string_value.charValue("");
in_string_value.charValue("");
status = dp_real_number._copy(out_string_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertTrue(out_string_value.charValue().compareTo("") == 0);
// copy string to string (value = "Test")
out_string_value.charValue("test");
in_string_value.charValue("Test");
status = dp_real_number._copy(out_string_value, in_string_value);
Assert.assertEquals(1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("Test") == 0);
// copy string to string (value = "Test", the same value)
out_string_value.charValue("Test");
in_string_value.charValue("Test");
status = dp_real_number._copy(out_string_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertTrue(out_string_value.charValue().compareTo("Test") == 0);
// copy string to string (value = null)
out_string_value.charValue("");
in_string_value.charValue(null);
status = dp_real_number._copy(out_string_value, in_string_value);
Assert.assertEquals(0, status);
Assert.assertTrue(out_string_value.charValue().compareTo("") == 0);
// copy null to string (value = null)
out_string_value.charValue("Test");
status = dp_real_number._copy(out_string_value, null);
Assert.assertEquals(-1, status);
Assert.assertTrue(out_string_value.charValue().compareTo("Test") == 0);
// copy string to string (value = null)
in_string_value.charValue("Test");
status = dp_real_number._copy(null, in_string_value);
Assert.assertEquals(-1, status);
}