MCPcopy Create free account
hub / github.com/brofield/simpleini / TEST_F

Function TEST_F

tests/ts-sections.cpp:15–41  ·  view source on GitHub ↗

Test GetSectionSize

Source from the content-addressed store, hash-verified

13
14// Test GetSectionSize
15TEST_F(TestSections, TestGetSectionSize) {
16 std::string input = "[section1]\n"
17 "key1 = value1\n"
18 "key2 = value2\n"
19 "key3 = value3\n"
20 "\n"
21 "[section2]\n"
22 "key1 = value1\n"
23 "\n"
24 "[empty]\n";
25
26 SI_Error rc = ini.LoadData(input);
27 ASSERT_EQ(rc, SI_OK);
28
29 int size = ini.GetSectionSize("section1");
30 ASSERT_EQ(size, 3);
31
32 size = ini.GetSectionSize("section2");
33 ASSERT_EQ(size, 1);
34
35 size = ini.GetSectionSize("empty");
36 ASSERT_EQ(size, 0);
37
38 // Non-existent section
39 size = ini.GetSectionSize("missing");
40 ASSERT_EQ(size, -1);
41}
42
43// Test GetSectionSize with multikey
44TEST_F(TestSections, TestGetSectionSizeMultikey) {

Callers

nothing calls this directly

Calls 13

GetSectionSizeMethod · 0.80
SetMultiKeyMethod · 0.80
GetSectionMethod · 0.80
SectionExistsMethod · 0.80
KeyExistsMethod · 0.80
SetAllowKeyOnlyMethod · 0.80
GetAllSectionsMethod · 0.80
GetAllKeysMethod · 0.80
SetValueMethod · 0.80
GetValueMethod · 0.80
IsEmptyMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected