summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/test/conversions.cpp12
-rw-r--r--slicer/test/preprocessor.cpp2
-rw-r--r--slicer/test/types.ice13
3 files changed, 26 insertions, 1 deletions
diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp
index fe0537c..1ea6239 100644
--- a/slicer/test/conversions.cpp
+++ b/slicer/test/conversions.cpp
@@ -77,5 +77,17 @@ namespace Slicer {
SHORT(tm.tm_year + 1900), SHORT(tm.tm_mon + 1), SHORT(tm.tm_mday),
SHORT(tm.tm_hour), SHORT(tm.tm_min), SHORT(tm.tm_sec)});
}
+
+ ::DB::Timespan
+ timedurationToTimespan(const boost::posix_time::time_duration & td)
+ {
+ return ::DB::Timespan({ SHORT(td.hours() / 24), SHORT(td.hours() % 24), SHORT(td.minutes()), SHORT(td.seconds()) });
+ }
+
+ boost::posix_time::time_duration
+ timespanToTimeduration(const ::DB::Timespan & ts)
+ {
+ return boost::posix_time::time_duration((ts.days * 24) + ts.hours, ts.minutes, ts.seconds);
+ }
}
diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp
index 9c1218b..bef901e 100644
--- a/slicer/test/preprocessor.cpp
+++ b/slicer/test/preprocessor.cpp
@@ -13,7 +13,7 @@
namespace fs = boost::filesystem;
-const unsigned int COMPONENTS_IN_TEST_ICE = 30;
+const unsigned int COMPONENTS_IN_TEST_ICE = 32;
BOOST_FIXTURE_TEST_SUITE ( preprocessor, FileStructure );
diff --git a/slicer/test/types.ice b/slicer/test/types.ice
index 8f44fa0..73da2a0 100644
--- a/slicer/test/types.ice
+++ b/slicer/test/types.ice
@@ -134,3 +134,16 @@ module TestModule2 {
};
};
+module DB {
+ [ "slicer:conversion:boost.posix_time.time_duration:timedurationToTimespan:timespanToTimeduration" ]
+ struct Timespan {
+ int days;
+ short hours;
+ short minutes;
+ short seconds;
+ };
+ class SpecificTypes extends TestModule::DateTimeContainer {
+ Timespan ts;
+ };
+};
+