END_TEST START_TEST (test_conversion_properties_write) { ConversionProperties props; props.addOption("key", "test", "test option"); fail_unless(props.getValue("key") == "test"); fail_unless(props.getType("key") == CNV_TYPE_STRING); fail_unless(props.getDescription("key") == "test option"); props.setBoolValue("key", true); fail_unless(props.getBoolValue("key") == true); fail_unless(props.getType("key") == CNV_TYPE_BOOL); props.setIntValue("key", 2); fail_unless(props.getIntValue("key") == 2); fail_unless(props.getType("key") == CNV_TYPE_INT); props.setFloatValue("key", 1.1f); fail_unless(props.getFloatValue("key") == 1.1f); fail_unless(props.getType("key") == CNV_TYPE_SINGLE); props.setDoubleValue("key", 2.1); fail_unless(props.getDoubleValue("key") == 2.1); fail_unless(props.getType("key") == CNV_TYPE_DOUBLE); }
END_TEST START_TEST (test_conversion_properties_clone) { ConversionProperties props; props.addOption("key", "test", "test option"); fail_unless(props.getValue("key") == "test"); fail_unless(props.getType("key") == CNV_TYPE_STRING); fail_unless(props.getDescription("key") == "test option"); ConversionProperties *prop1 = props.clone(); fail_unless(prop1->getValue("key") == "test"); fail_unless(prop1->getType("key") == CNV_TYPE_STRING); fail_unless(prop1->getDescription("key") == "test option"); delete prop1; }
END_TEST START_TEST (test_conversion_properties_assign) { ConversionProperties props; props.addOption("key", "test", "test option"); fail_unless(props.getValue("key") == "test"); fail_unless(props.getType("key") == CNV_TYPE_STRING); fail_unless(props.getDescription("key") == "test option"); ConversionProperties props2 = props; fail_unless(props2.getValue("key") == "test"); fail_unless(props2.getType("key") == CNV_TYPE_STRING); fail_unless(props2.getDescription("key") == "test option"); props2 = ConversionProperties(); fail_unless(props2.hasOption("key") == false); }