TestConfigOptions.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027
00028 #include "../include/TestConfigOptions.h"
00029 #include "../../include/PCMFileSystemManager.h"
00030
00031 namespace ParCompMarkTest
00032 {
00033
00034 void TestConfigOptions::setUp()
00035 {
00036 std::string currentLogFile = "logs/TestConfigOptions.log";
00037
00038 if(Logger::getInstance() && Logger::getInstance()->getLogFileName() != currentLogFile)
00039 Logger::destroyInstance();
00040
00041 if(!FileSystemManager::getInstance())
00042 {
00043 FileSystemManager::createInstance();
00044 FileSystemManager::getInstance()->setAppDirectory("./");
00045 FileSystemManager::getInstance()->initialize();
00046 }
00047
00048 if(!Logger::getInstance())
00049 {
00050 Logger::createInstance();
00051 Logger::getInstance()->setLogFileName(currentLogFile);
00052 Logger::getInstance()->initialize();
00053 }
00054 }
00055
00056
00057
00058 void TestConfigOptions::tearDown()
00059 {
00060 }
00061
00062
00063
00064
00065
00066
00067
00068 void TestConfigOptions::test_constructor()
00069 {
00070 ConfigOptions::Pointer options;
00071 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00072 }
00073
00074
00075
00076 void TestConfigOptions::test_destructor()
00077 {
00078
00079 }
00080
00081
00082
00083
00084
00085
00086
00087 void TestConfigOptions::test_initialize()
00088 {
00089
00090
00091
00092
00093
00094
00095
00096 ConfigOptions::Pointer options;
00097 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00098 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00099 }
00100
00101
00102
00103 void TestConfigOptions::test_finalize()
00104 {
00105
00106
00107
00108
00109
00110
00111
00112
00113 }
00114
00115
00116
00117 void TestConfigOptions::test_hasOption_cstd__string()
00118 {
00119
00120
00121
00122
00123
00124
00125
00126 ConfigOptions::Pointer options;
00127 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00128 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00129
00130
00131 CPPUNIT_ASSERT(!options->hasOption("something"));
00132
00133
00134 s32 val = 1234;
00135
00136 CPPUNIT_ASSERT_NO_THROW(options->setValue("something", &val, ConfigOptions::INTEGER, ""));
00137 CPPUNIT_ASSERT(options->hasOption("something"));
00138
00139
00140 CPPUNIT_ASSERT_NO_THROW(options->removeOption("something"));
00141 CPPUNIT_ASSERT(!options->hasOption("something"));
00142 }
00143
00144
00145
00146 void TestConfigOptions::test_getString_cstd__string()
00147 {
00148
00149
00150
00151
00152
00153
00154
00155 ConfigOptions::Pointer options;
00156 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00157 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00158
00159
00160 CPPUNIT_ASSERT_THROW(options->getString("something"), ParCompMark::Exception);
00161
00162
00163 CPPUNIT_ASSERT_NO_THROW(options->setString("something", "stuff"));
00164 CPPUNIT_ASSERT(options->getString("something") == "stuff");
00165
00166
00167 CPPUNIT_ASSERT_NO_THROW(options->removeOption("something"));
00168 CPPUNIT_ASSERT_THROW(options->getString("something"), ParCompMark::Exception);
00169 }
00170
00171
00172
00173 void TestConfigOptions::test_getBool_cstd__string()
00174 {
00175
00176
00177
00178
00179
00180
00181
00182 ConfigOptions::Pointer options;
00183 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00184 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00185
00186
00187 CPPUNIT_ASSERT_THROW(options->getBool("something"), ParCompMark::Exception);
00188
00189
00190 CPPUNIT_ASSERT_NO_THROW(options->setBool("something", true));
00191 CPPUNIT_ASSERT(options->getBool("something") == true);
00192
00193
00194 CPPUNIT_ASSERT_NO_THROW(options->removeOption("something"));
00195 CPPUNIT_ASSERT_THROW(options->getBool("something"), ParCompMark::Exception);
00196 }
00197
00198
00199
00200 void TestConfigOptions::test_getInteger_cstd__string()
00201 {
00202
00203
00204
00205
00206
00207
00208
00209 ConfigOptions::Pointer options;
00210 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00211 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00212
00213
00214 CPPUNIT_ASSERT_THROW(options->getInteger("something"), ParCompMark::Exception);
00215
00216
00217 CPPUNIT_ASSERT_NO_THROW(options->setInteger("something", 12345));
00218 CPPUNIT_ASSERT(options->getInteger("something") == 12345);
00219
00220
00221 CPPUNIT_ASSERT_NO_THROW(options->removeOption("something"));
00222 CPPUNIT_ASSERT_THROW(options->getInteger("something"), ParCompMark::Exception);
00223 }
00224
00225
00226
00227 void TestConfigOptions::test_getReal_cstd__string()
00228 {
00229
00230
00231
00232
00233
00234
00235
00236 ConfigOptions::Pointer options;
00237 CPPUNIT_ASSERT_NO_THROW(options = new ConfigOptions());
00238 CPPUNIT_ASSERT_NO_THROW(options->initialize());
00239
00240
00241 CPPUNIT_ASSERT_THROW(options->getReal("something"), ParCompMark::Exception);
00242
00243
00244 CPPUNIT_ASSERT_NO_THROW(options->setReal("something", 1.2345));
00245 CPPUNIT_ASSERT(options->getReal("something") == 1.2345);
00246
00247
00248 CPPUNIT_ASSERT_NO_THROW(options->removeOption("something"));
00249 CPPUNIT_ASSERT_THROW(options->getReal("something"), ParCompMark::Exception);
00250 }
00251
00252
00253
00254 void TestConfigOptions::test_testString_cstd__string_cstd__string()
00255 {
00256
00257
00258
00259
00260
00261
00262
00263 CPPUNIT_FAIL("Implement this test!");
00264 }
00265
00266
00267
00268 void TestConfigOptions::test_setString_cstd__string_cstd__string_cstd__string()
00269 {
00270
00271
00272
00273
00274
00275
00276
00277
00278 }
00279
00280
00281
00282 void TestConfigOptions::test_setBool_cstd__string_cbool_cstd__string()
00283 {
00284
00285
00286
00287
00288
00289
00290
00291
00292 }
00293
00294
00295
00296 void TestConfigOptions::test_setInteger_cstd__string_cs32_cstd__string()
00297 {
00298
00299
00300
00301
00302
00303
00304
00305
00306 }
00307
00308
00309
00310 void TestConfigOptions::test_setReal_cstd__string_cReal_cstd__string()
00311 {
00312
00313
00314
00315
00316
00317
00318
00319
00320 }
00321
00322
00323
00324 void TestConfigOptions::test_removeOption_cstd__string()
00325 {
00326
00327
00328
00329
00330
00331
00332
00333
00334 }
00335
00336
00337
00338 void TestConfigOptions::test_saveToIniFile_cstd__string()
00339 {
00340
00341
00342
00343
00344
00345
00346
00347 CPPUNIT_FAIL("Implement this test!");
00348 }
00349
00350
00351
00352 void TestConfigOptions::test_loadFromIniFile_cstd__string()
00353 {
00354
00355
00356
00357
00358
00359
00360
00361 CPPUNIT_FAIL("Implement this test!");
00362 }
00363
00364
00365
00366 void TestConfigOptions::test_getValue_cstd__string_cConfigOptions__OptionType()
00367 {
00368
00369
00370
00371
00372
00373
00374
00375
00376 }
00377
00378
00379
00380 void TestConfigOptions::test_setValue_cstd__string_cvoid_p_cConfigOptions__OptionType_cstd__string()
00381 {
00382
00383
00384
00385
00386
00387
00388
00389
00390 }
00391
00392
00393
00394 void TestConfigOptions::test_getOptionTypeSize_cConfigOptions__OptionType()
00395 {
00396
00397
00398
00399
00400
00401
00402
00403
00404 }
00405
00406
00407
00408 void TestConfigOptions::test_optionToString_ConfigOptions__Option__Pointer()
00409 {
00410
00411
00412
00413
00414
00415
00416
00417 CPPUNIT_FAIL("Implement this test!");
00418 }
00419
00420
00421
00422
00424 CPPUNIT_TEST_SUITE_REGISTRATION(TestConfigOptions);
00425 }