From c43f951f6ccd5dff742e927656385bedb0de7a03 Mon Sep 17 00:00:00 2001
From: Nikos Karastathis <n.karastathis@kit.edu>
Date: Mon, 23 Jan 2023 11:32:52 +0100
Subject: [PATCH] Fix unit tests

---
 corsika/detail/media/ExponentialRefractiveIndex.inl | 2 +-
 corsika/media/GladstoneDaleRefractiveIndex.hpp      | 2 +-
 tests/media/testRefractiveIndex.cpp                 | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/corsika/detail/media/ExponentialRefractiveIndex.inl b/corsika/detail/media/ExponentialRefractiveIndex.inl
index 172631250..c28b8e8c3 100644
--- a/corsika/detail/media/ExponentialRefractiveIndex.inl
+++ b/corsika/detail/media/ExponentialRefractiveIndex.inl
@@ -24,7 +24,7 @@ namespace corsika {
       , radius_(radius) {}
 
   template <typename T>
-  double ExponentialRefractiveIndex<T>::getRefractiveIndex(Point const& point) const {
+  inline double ExponentialRefractiveIndex<T>::getRefractiveIndex(Point const& point) const {
     return n0_ * exp((-lambda_) * (distance(point, center_) - radius_));
   }
 
diff --git a/corsika/media/GladstoneDaleRefractiveIndex.hpp b/corsika/media/GladstoneDaleRefractiveIndex.hpp
index 767351d8f..49a1b504c 100644
--- a/corsika/media/GladstoneDaleRefractiveIndex.hpp
+++ b/corsika/media/GladstoneDaleRefractiveIndex.hpp
@@ -22,8 +22,8 @@ namespace corsika {
   class GladstoneDaleRefractiveIndex final : public T {
 
     double const seaLevelRefractiveIndex_; ///< The constant refractive index at sea level.
-    MassDensityType const seaLevelDensity_; ///< The constant mass density at sea level.
     Point const earthSurface_; ///< A point at earth's surface.
+    MassDensityType const seaLevelDensity_; ///< The constant mass density at sea level.
 //    MassDensityType ratio_; ///< (1 - seaLevelRefractiveIndex_) / seaLevelDensity_.
 
   public:
diff --git a/tests/media/testRefractiveIndex.cpp b/tests/media/testRefractiveIndex.cpp
index 3a7bc077b..777624eaf 100644
--- a/tests/media/testRefractiveIndex.cpp
+++ b/tests/media/testRefractiveIndex.cpp
@@ -287,7 +287,9 @@ TEST_CASE("GladstoneDaleRefractiveIndex w/ 5-layered atmosphere") {
   auto const* const universe{env.getUniverse().get()};
   auto const* node{universe->getContainingNode(ref_)};
   // get the refractive index
-  auto const rIndex{node->getModelProperties().getRefractiveIndex(ref_)};
+  auto const rIndex1{node->getModelProperties().getRefractiveIndex(ref_)};
+  auto const rIndex2{node->getModelProperties().getRefractiveIndex(surface_)};
 
-//  CHECK(rIndex - n0 == Approx(0));
+  CHECK(rIndex1 - n0 == Approx(-0.0002591034));
+  CHECK(rIndex2 - n0 == Approx(0));
 }
\ No newline at end of file
-- 
GitLab