00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #include "fennel/common/CommonPreamble.h"
00025 #include "fennel/common/ConfigMap.h"
00026 #include "fennel/test/TestBase.h"
00027 #include "fennel/common/TraceSource.h"
00028 #include <boost/test/test_tools.hpp>
00029 #include <iostream>
00030 
00031 using namespace fennel;
00032 using std::string;
00033 
00036 class TestOptionsTest : public TestBase, public TraceSource
00037 {
00038     
00039     void test1();
00040     void test2();
00041 
00042     
00043     void extra();
00044 
00045 public:
00046     explicit TestOptionsTest()
00047         : TraceSource(shared_from_this(),"TestOptionsTest")
00048     {
00049         FENNEL_UNIT_TEST_CASE(TestOptionsTest, test1);
00050         FENNEL_UNIT_TEST_CASE(TestOptionsTest, test2);
00051         FENNEL_EXTRA_UNIT_TEST_CASE(TestOptionsTest, extra);
00052     }
00053 };
00054 
00055 void TestOptionsTest::test1()
00056 {
00057     int n = configMap.getIntParam("n", 100);
00058     string s = configMap.getStringParam("s", "fennel");
00059     FENNEL_TRACE(TRACE_INFO, "test1(): n = " << n << "; s = " << s);
00060 }
00061 
00062 void TestOptionsTest::test2()
00063 {
00064     int m = configMap.getIntParam("m", 200);
00065     int n = configMap.getIntParam("n", 201);
00066     string s = configMap.getStringParam("s", "fennel");
00067     FENNEL_TRACE(TRACE_INFO, "test2(): m = " << m << "; n = " << n << "; s = " << s);
00068 }
00069 
00070 void TestOptionsTest::extra()
00071 {
00072     int m = configMap.getIntParam("m", 300);
00073     int n = configMap.getIntParam("n", 301);
00074     string s = configMap.getStringParam("s", "fennel");
00075     FENNEL_TRACE(TRACE_INFO, "extra(): m = " << m << "; n = " << n << "; s = " << s);
00076 }
00077 
00078 FENNEL_UNIT_TEST_SUITE(TestOptionsTest)
00079 
00080