summaryrefslogtreecommitdiff
path: root/connectivity/qa
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-10-20 17:48:38 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-10-20 19:27:26 +0200
commitdab66665e231a13f086c66b561b440bdedecb572 (patch)
treee3977b7ae30d515f4e3876b6c8c87607a90b3252 /connectivity/qa
parent04fe0cae207e6f0a1fe7e2bd6d980d8880ae1572 (diff)
ORowSetValue: adapt test to new behaviour, extend test more
Change-Id: If28046653935051303fd487d87655bacbddf4644
Diffstat (limited to 'connectivity/qa')
-rw-r--r--connectivity/qa/connectivity/commontools/FValue_test.cxx92
1 files changed, 85 insertions, 7 deletions
diff --git a/connectivity/qa/connectivity/commontools/FValue_test.cxx b/connectivity/qa/connectivity/commontools/FValue_test.cxx
index 73b8af5f821f..8bab18be1140 100644
--- a/connectivity/qa/connectivity/commontools/FValue_test.cxx
+++ b/connectivity/qa/connectivity/commontools/FValue_test.cxx
@@ -20,6 +20,8 @@
#include <test/bootstrapfixture.hxx>
#include "connectivity/FValue.hxx"
+#include <com/sun/star/sdbc/DataType.hpp>
+using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::uno;
namespace connectivity { namespace commontools {
@@ -46,7 +48,10 @@ public:
void test_float();
void test_double();
- void test_getString();
+ void test_bool_getString();
+ void test_bit_getString();
+
+ void test_bool_creation();
CPPUNIT_TEST_SUITE(FValueTest);
@@ -67,7 +72,9 @@ public:
CPPUNIT_TEST(test_float);
CPPUNIT_TEST(test_double);
- CPPUNIT_TEST(test_getString);
+ CPPUNIT_TEST(test_bool_getString);
+ CPPUNIT_TEST(test_bit_getString);
+ CPPUNIT_TEST(test_bool_creation);
CPPUNIT_TEST_SUITE_END();
};
@@ -286,25 +293,96 @@ void FValueTest::test_double()
CPPUNIT_ASSERT_MESSAGE("double conversion from Any didn't work", src_double == trg_double);
}
-void FValueTest::test_getString()
+void FValueTest::test_bool_getString()
{
bool src_bool_1 = true;
ORowSetValue v_1(src_bool_1);
OUString trg_bool_1 = v_1.getString();
- std::cerr << "src_bool_1" << src_bool_1 << std::endl;
+ std::cerr << "src_bool_1: " << src_bool_1 << std::endl;
std::cerr << "trg_bool_1: " << trg_bool_1 << std::endl;
- CPPUNIT_ASSERT_MESSAGE("bool to string conversion to ORowSetValue didn't work", trg_bool_1 == "1");
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool to string conversion didn't work", trg_bool_1 == "true");
bool src_bool_0 = false;
ORowSetValue v_0(src_bool_0);
OUString trg_bool_0 = v_0.getString();
- std::cerr << "src_bool_0" << src_bool_0 << std::endl;
+ std::cerr << "src_bool_0: " << src_bool_0 << std::endl;
std::cerr << "trg_bool_0: " << trg_bool_0 << std::endl;
- CPPUNIT_ASSERT_MESSAGE("bool to string conversion to ORowSetValue didn't work", trg_bool_0 == "0");
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool to string conversion didn't work", trg_bool_0 == "false");
+}
+
+void FValueTest::test_bit_getString()
+{
+ bool src_bool_1 = true;
+ ORowSetValue v_1(src_bool_1);
+ v_1.setTypeKind(DataType::BIT);
+ OUString trg_bool_1 = v_1.getString();
+
+ std::cerr << "src_bit_1: " << src_bool_1 << std::endl;
+ std::cerr << "trg_bit_1: " << trg_bool_1 << std::endl;
+
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bit to string conversion didn't work", trg_bool_1 == "1");
+
+ bool src_bool_0 = false;
+ ORowSetValue v_0(src_bool_0);
+ v_0.setTypeKind(DataType::BIT);
+ OUString trg_bool_0 = v_0.getString();
+
+ std::cerr << "src_bit_0: " << src_bool_0 << std::endl;
+ std::cerr << "trg_bit_0: " << trg_bool_0 << std::endl;
+
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bit to string conversion didn't work", trg_bool_0 == "0");
+}
+
+void FValueTest::test_bool_creation()
+{
+ OUString s1("1");
+ OUString s0("0");
+ OUString sTrue("true");
+ OUString sTrUe("tRuE");
+ OUString sFalse("false");
+ ORowSetValue vTrue(true);
+ ORowSetValue vFalse(false);
+
+ {
+ ORowSetValue v(s1);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vTrue);
+ }
+
+ {
+ ORowSetValue v(s0);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vFalse);
+ }
+
+ {
+ ORowSetValue v(sTrue);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vTrue);
+ }
+
+ {
+ ORowSetValue v(sTrUe);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vTrue);
+ }
+
+ {
+ ORowSetValue v(sFalse);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vFalse);
+ }
+
+ {
+ ORowSetValue v(s0);
+ v.setTypeKind(DataType::BOOLEAN);
+ CPPUNIT_ASSERT_MESSAGE("ORowSetValue bool creation from string didn't work", v == vFalse);
+ }
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(FValueTest);