Browse Source

Merge pull request #994 from open62541/hotfix/osx_build

Fix unit tests on OS X
Stefan Profanter 8 years ago
parent
commit
6a2b66597e
2 changed files with 6 additions and 4 deletions
  1. 5 3
      tests/check_types_custom.c
  2. 1 1
      tools/travis/travis_osx_script.sh

+ 5 - 3
tests/check_types_custom.c

@@ -137,9 +137,11 @@ START_TEST(parseCustomArray) {
         ck_assert_ptr_eq(eo->content.decoded.type, &PointType);
         Point *p2 = (Point*)eo->content.decoded.data;
 
-        ck_assert(p2->x == ps[i].x);
-        ck_assert(p2->y == ps[i].y);
-        ck_assert(p2->z == ps[i].z);
+        // we need to cast floats to int to avoid comparison of floats
+        // which may result into false results
+        ck_assert((int)p2->x == (int)ps[i].x);
+        ck_assert((int)p2->y == (int)ps[i].y);
+        ck_assert((int)p2->z == (int)ps[i].z);
     }
         
     UA_Variant_deleteMembers(&var2);

+ 1 - 1
tools/travis/travis_osx_script.sh

@@ -47,7 +47,7 @@ else
 
     echo "Debug build and unit tests with valgrind" && echo -en 'travis_fold:start:script.build.unit_test\\r'
     mkdir -p build && cd build
-    cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=OFF -DUA_ENABLE_VALGRIND_UNIT_TESTS=OFF ..
+    cmake -DCMAKE_BUILD_TYPE=Debug -DUA_BUILD_EXAMPLES=ON -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON -DUA_BUILD_UNIT_TESTS=ON -DUA_ENABLE_COVERAGE=OFF -DUA_ENABLE_VALGRIND_UNIT_TESTS=OFF ..
     make -j && make test ARGS="-V"
     cd .. && rm -rf build
 	echo -en 'travis_fold:end:script.build.unit_test\\r'