From 5ef9115f0e4ffcb90b2434e89f83ce20deadf7ea Mon Sep 17 00:00:00 2001
From: PepMS <jmarti@iri.upc.edu>
Date: Mon, 30 Mar 2020 16:40:40 +0200
Subject: [PATCH] [tests] remove absolute path

---
 test/CMakeLists.txt         | 9 ++++++---
 test/gtest_observations.cpp | 4 +++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0b11665..9336592 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,7 +14,10 @@ include_directories(${GTEST_INCLUDE_DIRS})
 
 # Transformations test
 gnss_utils_add_gtest(gtest_transformations gtest_transformations.cpp)
-gnss_utils_add_gtest(gtest_observations gtest_observations.cpp)
-
 target_link_libraries(gtest_transformations ${PROJECT_NAME})
-target_link_libraries(gtest_observations ${PROJECT_NAME})
+
+# Observations test
+add_executable(gtest_observations gtest_observations.cpp)
+add_dependencies(gtest_observations libgtest)
+target_link_libraries(gtest_observations libgtest ${PROJECT_NAME})
+add_test(NAME gtest_observations COMMAND gtest_observations "${CMAKE_CURRENT_LIST_DIR}/../src/examples/sample_data.obs")
diff --git a/test/gtest_observations.cpp b/test/gtest_observations.cpp
index 3675a22..6a94280 100644
--- a/test/gtest_observations.cpp
+++ b/test/gtest_observations.cpp
@@ -4,6 +4,8 @@
 
 using namespace GNSSUtils;
 
+std::string rnx_file;
+
 TEST(ObservationsTest, LoadFromRinex)
 {
   gtime_t     t_start{ 0, 0 };  // no limit
@@ -11,7 +13,6 @@ TEST(ObservationsTest, LoadFromRinex)
   double      dt  = 0.0;        // no limit
   const char* opt = "-SYS=G";   // only GPS | GPS+GAL: "-SYS=G,L" | ALL: ""
 
-  const std::string& rnx_file = "/home/pepms/robotics/libraries/gnss_utils/src/examples/sample_data.obs";
   // GNSSUtils utilities
   Observations observations;
 
@@ -45,5 +46,6 @@ TEST(ObservationsTest, LoadFromRinex)
 int main(int argc, char** argv)
 {
   testing::InitGoogleTest(&argc, argv);
+  rnx_file = argv[1];
   return RUN_ALL_TESTS();
 }
\ No newline at end of file
-- 
GitLab