Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "gate/tests.hpp" | ||
2 | #include "gate/encode/inifiles.hpp" | ||
3 | |||
4 | using namespace gate; | ||
5 | using namespace gate::enc; | ||
6 | |||
7 | |||
8 |
2/7✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
6 | GATEXX_TEST_UNIT(IniFiles) |
9 | { | ||
10 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const section1 = String::createStaticFrom("Section1"); |
11 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const section2 = String::createStaticFrom("Section2"); |
12 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const key1 = String::createStaticFrom("key1"); |
13 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const value1 = String::createStaticFrom("value1"); |
14 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const key2 = String::createStaticFrom("key2"); |
15 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
2 | static String const value2 = String::createStaticFrom("value2"); |
16 | |||
17 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | StringStream iniOutput; |
18 | |||
19 | { | ||
20 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | IniFile iniFile; |
21 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.addSection(section1); |
22 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.set(section1, key1, value1); |
23 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.set(section1, key2, value2); |
24 | |||
25 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.addSection(section2); |
26 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.set(section2, key1, value1); |
27 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.set(section2, key2, value2); |
28 | |||
29 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.save(iniOutput); |
30 | } | ||
31 | |||
32 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
4 | String iniCopy = iniOutput.toView().clone(); |
33 | |||
34 | { | ||
35 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | IniFile iniFile; |
36 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | iniFile.load(iniOutput); |
37 | |||
38 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | String check1 = iniFile.get(section1, key1); |
39 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | String check2 = iniFile.get(section1, key2); |
40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | String check3 = iniFile.get(section2, key1); |
41 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | String check4 = iniFile.get(section2, key2); |
42 | |||
43 |
4/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | GATEXX_TEST_CHECK_EQUAL(check1, value1); |
44 |
4/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | GATEXX_TEST_CHECK_EQUAL(check2, value2); |
45 |
4/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | GATEXX_TEST_CHECK_EQUAL(check3, value1); |
46 |
4/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | GATEXX_TEST_CHECK_EQUAL(check4, value2); |
47 | } | ||
48 | |||
49 | { | ||
50 | /* TODO: implementation missing */ | ||
51 | /* | ||
52 | Property propTree = IniFile::parse(iniCopy); | ||
53 | Property::object_members_t members = propTree.getObjectMembers(); | ||
54 | Property propSec1 = members.getValue(section1); | ||
55 | Property propSec2 = members.getValue(section2); | ||
56 | |||
57 | String check1 = propSec1.getObjectMember(key1).getString(); | ||
58 | String check2 = propSec1.getObjectMember(key2).getString(); | ||
59 | String check3 = propSec2.getObjectMember(key1).getString(); | ||
60 | String check4 = propSec2.getObjectMember(key2).getString(); | ||
61 | |||
62 | GATEXX_TEST_CHECK_EQUAL(check1, value1); | ||
63 | GATEXX_TEST_CHECK_EQUAL(check2, value2); | ||
64 | GATEXX_TEST_CHECK_EQUAL(check3, value1); | ||
65 | GATEXX_TEST_CHECK_EQUAL(check4, value2); | ||
66 | */ | ||
67 | } | ||
68 | 2 | } | |
69 |