From 7338f7b35d093c5a7ae32010866a90039d03c367 Mon Sep 17 00:00:00 2001
From: joanvallve <jvallve@iri.upc.edu>
Date: Wed, 17 Mar 2021 19:47:59 +0100
Subject: [PATCH] wip test

---
 test/gtest_tdcp.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/test/gtest_tdcp.cpp b/test/gtest_tdcp.cpp
index cce86d8..0b160f3 100644
--- a/test/gtest_tdcp.cpp
+++ b/test/gtest_tdcp.cpp
@@ -1,4 +1,6 @@
 #include "gtest/utils_gtest.h"
+#include "gnss_utils/tdcp.h"
+#include "gnss_utils/snapshot.h"
 #include "gnss_utils/utils/satellite.h"
 #include "gnss_utils/utils/transformations.h"
 
@@ -19,7 +21,7 @@ Vector3d computeRandomReceiverLatLonAlt()
 void computeRandomVisibleSatellite(const Vector3d& receiver_latlonalt,
                                    Vector3d& sat_ENU,
                                    Vector3d& sat_ECEF,
-                                   Vectox_kd& sat_azel,
+                                   Vector2d& sat_azel,
                                    double range)
 {
     Vector3d t_ECEF_ENU, t_ENU_ECEF;
@@ -30,7 +32,7 @@ void computeRandomVisibleSatellite(const Vector3d& receiver_latlonalt,
     computeEnuEcefFromLatLonAlt(receiver_latlonalt, R_ENU_ECEF, t_ENU_ECEF);
 
     // random elevation and azimuth
-    sat_azel = Vectox_kd::Random();               // in [-1, 1]
+    sat_azel = Vector2d::Random();               // in [-1, 1]
     sat_azel(0) *= M_PI;                                // in [-pi, pi]
     sat_azel(1) = (sat_azel(1)/2 + 0.5) * M_PI / 2;     // in [0, pi/2]
     range = VectorXd::Random(1)(0) * 5e2 + 1e3;  // in [500, 1500]
@@ -53,7 +55,7 @@ TEST(Tdcp, Tdcp)
     Vector3d sat_ENU, sat_ECEF;
     Vector3d x_r_LLA, x_r_ECEF, x_k_LLA, x_k_ECEF, d_ECEF;
     Matrix3d R_ENU_ECEF;
-    Vectox_kd azel, azel2;
+    Vector2d azel, azel2;
     Vector4d d, d_gt;
     Matrix4d cov_d;
     double residual;
@@ -87,21 +89,21 @@ TEST(Tdcp, Tdcp)
         {
             common_sats.insert(j);
 
-            // Satellite 1 (random)
+            // Satellite r (random)
             computeRandomVisibleSatellite(x_r_LLA, sat_ENU, sat_ECEF, azel, range);
             EXPECT_MATRIX_APPROX(azel, computeAzel(sat_ECEF, x_r_ECEF), 1e-6);
 
-            Satellite sat1({0,j,sat_ECEF, Vector3d::Zero(), 1.0, 0, 0, 1});
-            snapshot1.getSatellites().emplace(j, sat1);
+            Satellite sat_r({0,j,sat_ECEF, Vector3d::Zero(), 1.0, 0, 0, 1});
+            snapshot_r->getSatellites().emplace(j, sat_r);
 
             // TODO: compute range and add random clock bias
 
-            // Satellite 2 (random)
+            // Satellite k (random)
             computeRandomVisibleSatellite(x_k_LLA, sat_ENU, sat_ECEF, azel, range);
             EXPECT_MATRIX_APPROX(azel, computeAzel(sat_ECEF, x_k_ECEF), 1e-6);
 
-            Satellite sat2({0,j,sat_ECEF, Vector3d::Zero(), 1.0, 0, 0, 1});
-            snapshot2.getSatellites().emplace(j, sat2);
+            Satellite sat_k({0,j,sat_ECEF, Vector3d::Zero(), 1.0, 0, 0, 1});
+            snapshot_k->getSatellites().emplace(j, sat_k);
 
             // TODO: compute range and add random clock bias
         }
@@ -120,7 +122,7 @@ TEST(Tdcp, Tdcp)
 
         EXPECT_TRUE(tdcp_ok);
         EXPECT_MATRIX_APPROX(d, d_gt, 1e-9);
-        EXPECT_LEQ(residual, 1e-9);
+        EXPECT_LE(residual, 1e-9);
     }
 }
 
-- 
GitLab