summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-07-09 14:03:48 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-07-10 16:03:41 +0100
commitcc2524203927d4dba88a87b667c0e235b081cb3a (patch)
tree1aaab69bf58b516a5ff0527057666bf8679dd54a
parentAdd basic components for populating options classes from Ice::Properties (diff)
downloadicetray-cc2524203927d4dba88a87b667c0e235b081cb3a.tar.bz2
icetray-cc2524203927d4dba88a87b667c0e235b081cb3a.tar.xz
icetray-cc2524203927d4dba88a87b667c0e235b081cb3a.zip
Refactor test options class into its own lib
-rw-r--r--icetray/unittests/Jamfile.jam8
-rw-r--r--icetray/unittests/testIceTrayOptions.cpp20
-rw-r--r--icetray/unittests/testOptions.cpp14
-rw-r--r--icetray/unittests/testOptions.h18
4 files changed, 41 insertions, 19 deletions
diff --git a/icetray/unittests/Jamfile.jam b/icetray/unittests/Jamfile.jam
index 2b44a74..ee2c429 100644
--- a/icetray/unittests/Jamfile.jam
+++ b/icetray/unittests/Jamfile.jam
@@ -89,10 +89,18 @@ run
<library>testCommon
;
+lib testOptions
+ :
+ testOptions.cpp
+ : :
+ <library>testCommon
+ ;
+
run
testIceTrayOptions.cpp
: : :
<library>testCommon
+ <library>testOptions
;
IMPORT $(__name__) : icetray.c++.sql : : icetray.c++.sql ;
diff --git a/icetray/unittests/testIceTrayOptions.cpp b/icetray/unittests/testIceTrayOptions.cpp
index 2c56537..a8fe157 100644
--- a/icetray/unittests/testIceTrayOptions.cpp
+++ b/icetray/unittests/testIceTrayOptions.cpp
@@ -1,30 +1,12 @@
#define BOOST_TEST_MODULE TestIceTrayLogger
#include <boost/test/unit_test.hpp>
-#include <options.h>
+#include "testOptions.h"
#include <Ice/Communicator.h>
#include <Ice/ObjectAdapter.h>
#include <Ice/Initialize.h>
#include "icetrayService.h"
-class TestOptions : public IceTray::Options {
- public:
- TestOptions() : IceTray::Options("Test options")
- {
- }
-
- ICETRAY_OPTIONS_INLINE(
- ("testInt", boost::program_options::value(&testInt), "testInt")
- ("testString", boost::program_options::value(&testString)->default_value("some string"), "testString")
- ("vec", boost::program_options::value(&testVec), "vector")
- );
-
- int testInt;
- std::string testString;
- std::vector<int> testVec;
-};
-FACTORY(TestOptions, IceTray::OptionsFactory);
-
class TestService : public IceTray::Service {
public:
void addObjects(const std::string &, const Ice::CommunicatorPtr &, const Ice::StringSeq &, const Ice::ObjectAdapterPtr &)
diff --git a/icetray/unittests/testOptions.cpp b/icetray/unittests/testOptions.cpp
new file mode 100644
index 0000000..b0bfdee
--- /dev/null
+++ b/icetray/unittests/testOptions.cpp
@@ -0,0 +1,14 @@
+#include "testOptions.h"
+
+TestOptions::TestOptions() : IceTray::Options("Test options")
+{
+}
+
+ICETRAY_OPTIONS(TestOptions,
+ ("testInt", boost::program_options::value(&testInt), "testInt")
+ ("testString", boost::program_options::value(&testString)->default_value("some string"), "testString")
+ ("vec", boost::program_options::value(&testVec), "vector")
+);
+
+FACTORY(TestOptions, IceTray::OptionsFactory);
+
diff --git a/icetray/unittests/testOptions.h b/icetray/unittests/testOptions.h
new file mode 100644
index 0000000..06adb19
--- /dev/null
+++ b/icetray/unittests/testOptions.h
@@ -0,0 +1,18 @@
+#ifndef ICETRAY_TEST_TESTOPTIONS_H
+#define ICETRAY_TEST_TESTOPTIONS_H
+
+#include <options.h>
+
+class DLL_PUBLIC TestOptions : public IceTray::Options {
+ public:
+ TestOptions();
+
+ ICETRAY_OPTIONS_DECLARE;
+
+ int testInt;
+ std::string testString;
+ std::vector<int> testVec;
+};
+
+#endif
+