RDK Documentation (Open Sourced RDK Components)
testPersistence.cpp
1
/*
2
* If not stated otherwise in this file or this component's Licenses.txt file the
3
* following copyright and licenses apply:
4
*
5
* Copyright 2016 RDK Management
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
20
// TODO: Include your class to test here.
21
22
23
/**
24
* @defgroup devicesettings
25
* @{
26
* @defgroup test
27
* @{
28
**/
29
30
31
#define BOOST_TEST_MODULE HostPersistence
32
#define BOOST_TEST_MAIN
33
#include "boost/test/included/unit_test.hpp"
34
#include <iostream>
35
#include "hostPersistence.hpp"
36
37
BOOST_AUTO_TEST_CASE(test_hostPersistence)
38
{
39
try
{
40
device::HostPersistence
*pClass =
new
device::HostPersistence
();
41
pClass->
load
();
42
pClass->
persistHostProperty
(
"Testing1"
,
"10"
);
43
pClass->
persistHostProperty
(
"Testing2"
,
"16"
);
44
pClass->
persistHostProperty
(
"Testing3"
,
"987654321"
);
45
pClass->
persistHostProperty
(
"Testing3"
,
"111111111"
);
46
pClass->
persistHostProperty
(
"Testing5"
,
""
);
47
pClass->
persistHostProperty
(
"Testing6"
,
"0"
);
48
pClass->getProperty(
"Testing2"
);
49
pClass->getProperty(
"Testing1"
);
50
pClass->getProperty(
"Testing1"
,
"g"
);
51
pClass->getProperty(
"Testing4"
,
"lol"
);
52
pClass->getProperty(
"Testing4"
);
53
pClass->getProperty(
"Testing5"
);
54
pClass->getProperty(
"Testing5"
,
"lol"
);
55
pClass->getProperty(
"Testing6"
,
"123"
);
56
pClass->getProperty(
"Testing3"
);
57
pClass->getProperty(
"Testing11"
,
"123"
);
58
59
pClass->
load
();
60
pClass->
persistHostProperty
(
"Testing1"
,
"10"
);
61
pClass->
persistHostProperty
(
"Testing2"
,
"16"
);
62
pClass->getProperty(
"Testing3"
);
63
64
device::HostPersistence
*pClass2 =
new
device::HostPersistence
(
"oNe"
);
65
pClass2->
load
();
66
pClass2->
persistHostProperty
(
"Hello1"
,
"10"
);
67
pClass2->
persistHostProperty
(
"Hello2"
,
"16"
);
68
pClass2->
persistHostProperty
(
"Hello3"
,
"987654321"
);
69
pClass2->
persistHostProperty
(
"Hello3"
,
"111111111"
);
70
pClass2->
persistHostProperty
(
"Hello5"
,
""
);
71
pClass2->
persistHostProperty
(
"Hello6"
,
"0"
);
72
pClass2->getProperty(
"Hello2"
);
73
pClass2->getProperty(
"Hello1"
);
74
pClass2->getProperty(
"Hello1"
,
"g"
);
75
pClass2->getProperty(
"Hello4"
,
"lol"
);
76
pClass2->getProperty(
"Hello4"
);
77
pClass2->getProperty(
"Hello5"
);
78
pClass2->getProperty(
"Hello5"
,
"lol"
);
79
pClass2->getProperty(
"Hello6"
,
"123"
);
80
pClass2->getProperty(
"Hello3"
);
81
pClass2->getProperty(
"Hello11"
,
"123"
);
82
83
pClass2->
load
();
84
pClass2->
persistHostProperty
(
"Hello1"
,
"10"
);
85
pClass2->
persistHostProperty
(
"Hello2"
,
"16"
);
86
pClass2->getProperty(
"Hello3"
);
87
88
89
}
90
catch
(...) {
91
BOOST_CHECK(0);
92
}
93
}
94
95
BOOST_AUTO_TEST_CASE(testDummy)
96
{
97
BOOST_CHECK(1 == 1);
98
}
99
100
101
/** @} */
102
/** @} */
device::HostPersistence::persistHostProperty
void persistHostProperty(const std::string &key, const std::string &value)
Definition:
hostPersistence.cpp:273
device::HostPersistence::load
void load()
Definition:
hostPersistence.cpp:133
device::HostPersistence
Definition:
hostPersistence.hpp:38
components
generic
devicesettings
test
testPersistence.cpp
Generated on Thu Feb 9 2023 06:32:30 for RDK Documentation (Open Sourced RDK Components) by
1.8.17