From 2308a691799e0f701cc44b34041b84d88d53a9ee Mon Sep 17 00:00:00 2001
From: Wiebe van Breukelen <breukelen@astron.nl>
Date: Tue, 6 May 2025 10:45:06 +0200
Subject: [PATCH] Add test_radec_to_lmn_xsimd_with_remainder

---
 tests/test_directions.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/test_directions.cpp b/tests/test_directions.cpp
index 984bd14..5db962c 100644
--- a/tests/test_directions.cpp
+++ b/tests/test_directions.cpp
@@ -114,4 +114,31 @@ BOOST_AUTO_TEST_CASE(test_radec_to_lmn_xsimd) {
   }
 }
 
+BOOST_AUTO_TEST_CASE(test_radec_to_lmn_xsimd_with_remainder) {
+  Direction reference(0.2, 0.3);
+  Direction dir_0(0.1, 0.2);
+  Direction dir_1(0.2, 0.3);
+  Direction dir_2(0.3, 0.4);
+
+  xt::xtensor<double, 2> lmn_expected({3, 3});
+
+  dp3::base::radec2lmn(reference, dir_0, &lmn_expected(0, 0));
+  dp3::base::radec2lmn(reference, dir_1, &lmn_expected(1, 0));
+  dp3::base::radec2lmn(reference, dir_2, &lmn_expected(2, 0));
+
+  Directions directions;
+  directions.add(dir_0);
+  directions.add(dir_1);
+  directions.add(dir_2);
+
+  xt::xtensor<double, 2> lmn_actual({3, 3});
+  directions.radec2lmn<Directions::computation_strategy::MULTI_SIMD>(
+      reference, lmn_actual);
+  for (size_t i; i < 3; ++i) {
+    BOOST_CHECK_CLOSE(lmn_expected(i, 0), lmn_actual(i, 0), 1.e-6);
+    BOOST_CHECK_CLOSE(lmn_expected(i, 1), lmn_actual(i, 1), 1.e-6);
+    BOOST_CHECK_CLOSE(lmn_expected(i, 2), lmn_actual(i, 2), 1.e-6);
+  }
+}
+
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
-- 
GitLab