[Tests/Plugins] Avoid warnings caused by a GCC bug related to gtest
authorWook Song <wook16.song@samsung.com>
Wed, 18 Sep 2019 08:43:59 +0000 (17:43 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 19 Sep 2019 10:20:02 +0000 (19:20 +0900)
A GCC bug [1] might cause warnings related to 'conversion-null' when
using googletest macros with !FALSE as arguments. Therefore, in the case
that Werror is true, the build would be broken by this bug. To avoid
such situation, this patch replaces EXPECT_EQs in the plugin unit tests
with EXPECT_TRUE or EXPECT_FALSE.

[1] https://github.com/google/googletest/issues/322

Signed-off-by: Wook Song <wook16.song@samsung.com>
tests/nnstreamer_plugins/unittest_plugins.cpp

index c0380e3..7e7be8d 100644 (file)
@@ -141,7 +141,8 @@ TEST (test_tensor_transform, properties)
 
   g_object_set (transform, "silent", !default_silent, NULL);
   g_object_get (transform, "silent", &res_silent, NULL);
-  EXPECT_EQ (!default_silent, res_silent);
+  /** expect FALSE, which is !default_silent */
+  EXPECT_FALSE (res_silent);
 
   /**
    * If HAVE_ORC is set, default acceleration is TRUE.
@@ -153,7 +154,8 @@ TEST (test_tensor_transform, properties)
 #ifdef HAVE_ORC
   g_object_set (transform, "acceleration", !default_accl, NULL);
   g_object_get (transform, "acceleration", &accl, NULL);
-  EXPECT_EQ (!default_accl, accl);
+  /** expect FALSE, which is !default_accl */
+  EXPECT_FALSE (accl);
 #endif
 
   /** We do not need to test setting properties for 'mode' and 'option' */