RDK Documentation (Open Sourced RDK Components)
testLogger.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 Logger
32 #define BOOST_TEST_MAIN
33 #include "boost/test/included/unit_test.hpp"
34 #include <iostream>
35 
36 #include "logger.hpp"
37 
38 using namespace rdkutil;
39 
40 
41 BOOST_AUTO_TEST_CASE(test_Logger)
42 {
43  try {
44  rdkutil::Logger &testLog1 = rdkutil::Logger::getLogger("");
45  testLog1.fatal("Test fatal");
46  testLog1.error("Test error");
47  testLog1.warn("Test warn");
48  testLog1.info("Test info");
49  testLog1.debug("Test debug");
50  testLog1.trace("Test trace");
51  testLog1.isErrorEnabled ();
52  testLog1.isWarnEnabled();
53  testLog1.isInfoEnabled();
54  testLog1.isDebugEnabled();
55  testLog1.isTraceEnabled();
56  testLog1.enableError();
57  testLog1.enableInfo();
58  testLog1.enableDebug();
59  testLog1.enableTrace();
60 
61  rdkutil::Logger &testLog2 = rdkutil::Logger::getLogger("Test 1");
62  testLog2.fatal("Test fatal");
63  testLog2.error("Test error");
64  testLog2.warn("Test warn");
65  testLog2.info("Test info");
66  testLog2.debug("Test debug");
67  testLog2.trace("Test trace");
68  testLog2.isErrorEnabled ();
69  testLog2.isWarnEnabled();
70  testLog2.isInfoEnabled();
71  testLog2.isDebugEnabled();
72  testLog2.isTraceEnabled();
73  testLog2.enableError();
74  testLog2.enableInfo();
75  testLog2.enableDebug();
76  testLog2.enableTrace();
77 
78  }
79  catch(...) {
80  BOOST_CHECK(0);
81  }
82 }
83 
84 BOOST_AUTO_TEST_CASE(testDummy)
85 {
86  BOOST_CHECK(1 == 1);
87 }
88 
89 
90 /** @} */
91 /** @} */