blob: 2d0e001bf665e26699db8fdfcc458f1b71e0b2a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "Option.h"
#include <string>
#include <cppunit/extensions/HelperMacros.h>
using namespace std;
class OptionTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(OptionTest);
CPPUNIT_TEST(testPutAndGet);
CPPUNIT_TEST(testPutAndGetAsInt);
CPPUNIT_TEST_SUITE_END();
private:
public:
void setUp() {
}
void testPutAndGet();
void testPutAndGetAsInt();
};
CPPUNIT_TEST_SUITE_REGISTRATION( OptionTest );
void OptionTest::testPutAndGet() {
Option op;
op.put("key", "value");
CPPUNIT_ASSERT(op.defined("key"));
CPPUNIT_ASSERT_EQUAL(string("value"), op.get("key"));
}
void OptionTest::testPutAndGetAsInt() {
Option op;
op.put("key", "1000");
CPPUNIT_ASSERT(op.defined("key"));
CPPUNIT_ASSERT_EQUAL(1000, op.getAsInt("key"));
}
|