| Web Wispers 1.2.1 C++ Unit Test Coverage |
|
|
|
|
|
Branch data Line data Source code
1 : : /*
2 : : * Copyright 2006-2009 Savarese Software Research Corporation
3 : : *
4 : : * Licensed under the Apache License, Version 2.0 (the "License");
5 : : * you may not use this file except in compliance with the License.
6 : : * You may obtain a copy of the License at
7 : : *
8 : : * http://www.savarese.com/software/ApacheLicense-2.0
9 : : *
10 : : * Unless required by applicable law or agreed to in writing, software
11 : : * distributed under the License is distributed on an "AS IS" BASIS,
12 : : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : : * See the License for the specific language governing permissions and
14 : : * limitations under the License.
15 : : */
16 : :
17 : : #include <tests/TestCommon.h>
18 : : #include <ssrc/wispers/utility/DynamicLibrary.h>
19 : :
20 : : using namespace NS_SSRC_WSPR_UTILITY;
21 : :
22 : : extern "C" typedef int fun_type();
23 : : extern "C" typedef fun_type* fun_ptr;
24 : :
25 [ - + ]: 3 : struct DynamicLibraryTest : public TestCase {
26 : :
27 : 1 : void test_symbol() {
28 [ + - + - : 2 : DynamicLibrary library("dltest.so");
+ - ]
29 : :
30 [ + - + - : 1 : CPPUNIT_ASSERT(library.filename() == "dltest.so");
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - ]
31 : :
32 [ + - + - : 1 : fun_ptr run_test = library.symbol<fun_ptr>("test42");
+ - ]
33 : :
34 [ + - + - : 1 : CPPUNIT_ASSERT(run_test != 0);
+ - + - +
- + - + -
+ - + - +
- + - ]
35 [ + - + - : 1 : CPPUNIT_ASSERT(run_test() == 42);
+ - + - +
- + - + -
+ - + - +
- + - +
- ]
36 : 1 : }
37 : :
38 [ + - + - : 4 : CPPUNIT_TEST_SUITE(DynamicLibraryTest);
+ - # # ]
39 [ + - + - : 1 : CPPUNIT_TEST(test_symbol);
+ - + - +
- + - + -
+ - ]
40 [ + - + - : 2 : CPPUNIT_TEST_SUITE_END();
+ - + - +
- + - ]
41 : : };
42 : :
43 [ - + # # ]: 1 : CPPUNIT_TEST_SUITE_REGISTRATION(DynamicLibraryTest);
44 [ + - + - : 4 : WISP_TEST_MAIN()
+ - + - +
- + - + -
+ - + - +
- + - ]
|
Copyright © 2011 Savarese Software Research Corporation. All rights reserved