I tried running code coverage to see how good my test cases is. Then I found out there are some lines that got ignored by LCOV, like line 6,7,10,13 below. Why does LCOV does not take these into account when lines like line 6 (class domain {
) clearly ran during the test.
1 : #include "ros/ros.h"
2 : #include "gtest/gtest.h"
3 :
4 :
5 :
6 : class domath {
7 : public:
8 1 : int multiply(int a, int b) {return a * b;}
9 :
10 : };
11 :
12 5 : TEST(TestSuite, multiply_test_case1){
13 : domath math1;
14 1 : int a = 3;
15 1 : int b = 4;
16 1 : int c = math1.multiply(a,b);
17 1 : EXPECT_EQ(c,12) << "value should be 12";
18 :
19 1 : }
20 :
21 :
22 1 : int main(int argc, char **argv){
23 :
24 1 : testing::InitGoogleTest(&argc , argv);
25 1 : return RUN_ALL_TESTS();
26 :
27 3 : }
28 :