Exclude code lines for code coverage 96/298496/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 8 Sep 2023 00:58:46 +0000 (09:58 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 8 Sep 2023 00:58:46 +0000 (09:58 +0900)
Some code lines of unittests are excluded.

Change-Id: Ida5868b136499ec45bc3069f22102acb19d565bd
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
tests/application_unittests/app_main_legacy_test.cc
tests/application_unittests/app_main_test.cc
tests/application_unittests/main.cc
tests/application_unittests/mock/test_fixture.hh

index ea22480..2473096 100644 (file)
@@ -38,7 +38,9 @@ GMainLoop* loop_;
 
 void FakeRun(int argc, char** argv) {}
 
+// LCOV_EXCL_START
 void FakeAddEvent(std::shared_ptr<tizen_cpp::AppCoreBase::EventBase> event) {}
+// LCOV_EXCL_STOP
 
 bool FakeRemoveEvent(std::shared_ptr<tizen_cpp::AppCoreBase::EventBase> event) {
   return true;
@@ -46,14 +48,6 @@ bool FakeRemoveEvent(std::shared_ptr<tizen_cpp::AppCoreBase::EventBase> event) {
 
 void FakeExit() {}
 
-int FakeGetWindowPosition(int* x, int* y, int* w, int* h) {
-  *x = 1920;
-  *y = 1024;
-  *w = 1920;
-  *h = 1024;
-  return 0;
-}
-
 void FakeOnLoopInit(int argc, char** argv) {
   loop_ = g_main_loop_new(nullptr, FALSE);
 }
@@ -83,6 +77,7 @@ void AppTerminateCb(void* user_data) {}
 
 void AppControlCb(app_control_h app_control, void* user_data) {}
 
+// LCOV_EXCL_START
 void AppLowMemoryCb(void* user_data) {}
 
 void AppLowBatteryCb(void* user_data) {}
@@ -93,6 +88,7 @@ void AppDeviceOrientationCb(app_device_orientation_e orientation,
 void AppLanguageChangedCb(void* user_data) {}
 
 void AppRegionFormatChangedCb(void* user_data) {}
+// LCOV_EXCL_STOP
 
 }  // namespace
 
@@ -110,8 +106,6 @@ class AppMainLegacyTest : public TestFixture {
         .WillRepeatedly(Invoke(FakeAddEvent));
     EXPECT_CALL(GetMock<AppCoreEflMock>(), RemoveEvent(_))
         .WillRepeatedly(Invoke(FakeRemoveEvent));
-    EXPECT_CALL(GetMock<AppCoreEflMock>(), GetWindowPosition(_, _, _, _))
-        .WillRepeatedly(Invoke(FakeGetWindowPosition));
     EXPECT_CALL(GetMock<AppCoreEflMock>(), OnLoopInit(_, _))
         .WillRepeatedly(Invoke(FakeOnLoopInit));
     EXPECT_CALL(GetMock<AppCoreEflMock>(), OnLoopFinish())
index f4efc8e..1581d22 100644 (file)
@@ -38,11 +38,13 @@ GMainLoop* loop_;
 
 void FakeRun(int argc, char** argv) {}
 
+// LCOV_EXCL_START
 void FakeAddEvent(std::shared_ptr<tizen_cpp::AppCoreBase::EventBase> event) {}
 
 bool FakeRemoveEvent(std::shared_ptr<tizen_cpp::AppCoreBase::EventBase> event) {
   return true;
 }
+// LCOV_EXCL_STOP
 
 void FakeExit() {}
 
@@ -83,7 +85,7 @@ void AppTerminateCb(void* user_data) {}
 
 void AppControlCb(app_control_h app_control, void* user_data) {}
 
-void AppEventCb(app_event_info_h event_info, void* user_data) {}
+void AppEventCb(app_event_info_h event_info, void* user_data) {}  // LCOV_EXCL_LINE
 
 }  // namespace
 
index f1c49aa..3d9fd45 100644 (file)
@@ -22,7 +22,9 @@ int main(int argc, char** argv) {
     testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
   } catch (std::exception const &e) {
+    // LCOV_EXCL_START
     std::cout << "test_main caught exception: " << e.what() << std::endl;
     return -1;
+    // LCOV_EXCL_STOP
   }
 }
index 0b1a1bc..49c5873 100644 (file)
@@ -35,15 +35,19 @@ class TestFixture : public ::testing::Test {
     mock_.reset();
   }
 
-  virtual void SetUp() {}
-  virtual void TearDown() {}
+  virtual void SetUp() {}  // LCOV_EXCL_LINE
+  virtual void TearDown() {}  // LCOV_EXCL_LINE
 
   template <typename T>
   static T& GetMock() {
     auto ptr = dynamic_cast<T*>(mock_.get());
-    if (!ptr)
+    if (!ptr) {
+      // LCOV_EXCL_START
       throw std::invalid_argument("The test does not provide mock of \"" +
           std::string(typeid(T).name()) + "\"");
+      // LCOV_EXCL_STOP
+    }
+
     return *ptr;
   }