diff options
Diffstat (limited to 'slicer/db')
-rw-r--r-- | slicer/db/Jamfile.jam | 20 | ||||
-rw-r--r-- | slicer/db/testConversions.cpp | 23 | ||||
-rw-r--r-- | slicer/db/testInsert.cpp | 2 | ||||
-rw-r--r-- | slicer/db/testModels.ice | 34 | ||||
-rw-r--r-- | slicer/db/testPatch.cpp | 2 | ||||
-rw-r--r-- | slicer/db/testSelect.cpp | 2 | ||||
-rw-r--r-- | slicer/db/testUpdate.cpp | 2 |
7 files changed, 80 insertions, 5 deletions
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam index ad15a6c..b8e45cc 100644 --- a/slicer/db/Jamfile.jam +++ b/slicer/db/Jamfile.jam @@ -13,7 +13,7 @@ lib IceUtil ; lib slicer-db : [ glob *.cpp : test*.cpp ] - [ glob *.ice ] + [ glob *.ice : test*.ice ] : <include>.. <library>pthread @@ -30,6 +30,16 @@ lib slicer-db : path-constant me : . ; +lib testCommon : + [ glob testConversions.cpp test*.ice ] + : + <dependency>../tool//slicer + <slicer>yes + <slicerbin>../tool//slicer + <implicit-dependency>../test//types + <library>../test//types + ; + run testSelect.cpp : : : <define>BOOST_TEST_DYN_LINK @@ -43,6 +53,8 @@ run testSelect.cpp <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer + <library>testCommon + <implicit-dependency>testCommon <include>.. <dependency>slicer.sql : @@ -61,6 +73,8 @@ run testInsert.cpp <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer + <library>testCommon + <implicit-dependency>testCommon <include>.. <dependency>slicer.sql : @@ -79,6 +93,8 @@ run testPatch.cpp <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer + <library>testCommon + <implicit-dependency>testCommon <include>.. <dependency>slicer.sql ; @@ -96,6 +112,8 @@ run testUpdate.cpp <library>../test//common <library>../slicer//slicer <implicit-dependency>../slicer//slicer + <library>testCommon + <implicit-dependency>testCommon <include>.. <dependency>slicer.sql : diff --git a/slicer/db/testConversions.cpp b/slicer/db/testConversions.cpp new file mode 100644 index 0000000..893c6ae --- /dev/null +++ b/slicer/db/testConversions.cpp @@ -0,0 +1,23 @@ +#include <testModels.h> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/numeric/conversion/cast.hpp> +#include <visibility.h> + +#define SHORT(x) boost::numeric_cast< ::Ice::Short , int64_t >(x) + +namespace Slicer { + DLL_PUBLIC + ::TestDatabase::TimespanPtr + timedurationToTimespan(const boost::posix_time::time_duration & td) + { + return new ::TestDatabase::Timespan(SHORT(td.hours() / 24), SHORT(td.hours() % 24), SHORT(td.minutes()), SHORT(td.seconds())); + } + + DLL_PUBLIC + boost::posix_time::time_duration + timespanToTimeduration(const ::TestDatabase::TimespanPtr & ts) + { + return boost::posix_time::time_duration((ts->days * 24) + ts->hours, ts->minutes, ts->seconds); + } +} + diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp index 34a236f..fec0ed7 100644 --- a/slicer/db/testInsert.cpp +++ b/slicer/db/testInsert.cpp @@ -8,7 +8,7 @@ #include "sqlSelectDeserializer.h" #include <types.h> #include <common.h> -#include <db.h> +#include <testModels.h> // LCOV_EXCL_START BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime); diff --git a/slicer/db/testModels.ice b/slicer/db/testModels.ice new file mode 100644 index 0000000..a586503 --- /dev/null +++ b/slicer/db/testModels.ice @@ -0,0 +1,34 @@ +#ifndef SLICER_TEST_DB +#define SLICER_TEST_DB + +#include <classes.ice> + +module TestDatabase { + [ "slicer:conversion:boost.posix_time.time_duration:timedurationToTimespan:timespanToTimeduration" ] + class Timespan { + int days; + short hours; + short minutes; + short seconds; + }; + class SpecificTypes extends TestModule::DateTimeContainer { + Timespan ts; + }; + class BuiltIns { + optional(1) bool mbool; + optional(2) byte mbyte; + optional(3) short mshort; + ["slicer:db:pkey", + "slicer:db:auto"] + int mint; + ["slicer:db:pkey"] + long mlong; + optional(4) float mfloat; + optional(5) double mdouble; + optional(6) string mstring; + }; + sequence<BuiltIns> BuiltInSeq; +}; + +#endif + diff --git a/slicer/db/testPatch.cpp b/slicer/db/testPatch.cpp index 333b806..012f2f5 100644 --- a/slicer/db/testPatch.cpp +++ b/slicer/db/testPatch.cpp @@ -8,7 +8,7 @@ #include "sqlSelectDeserializer.h" #include <types.h> #include <common.h> -#include <db.h> +#include <testModels.h> // LCOV_EXCL_START BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime); diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp index 5428f29..e50047a 100644 --- a/slicer/db/testSelect.cpp +++ b/slicer/db/testSelect.cpp @@ -7,7 +7,7 @@ #include "sqlSelectDeserializer.h" #include <types.h> #include <common.h> -#include <db.h> +#include <testModels.h> #include <sqlExceptions.h> class StandardMockDatabase : public PQ::Mock { diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp index 624149d..29115e3 100644 --- a/slicer/db/testUpdate.cpp +++ b/slicer/db/testUpdate.cpp @@ -9,7 +9,7 @@ #include "sqlUpdateSerializer.h" #include <types.h> #include <common.h> -#include <db.h> +#include <testModels.h> #include <sqlExceptions.h> class StandardMockDatabase : public PQ::Mock { |