From d6dccdde0278a08c2448862fbf296a3974557eeb Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 14 Oct 2023 19:50:39 +0200 Subject: [PATCH] Test s11n. --- test/kepF.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/kepF.cpp b/test/kepF.cpp index 59999d32d..3cb73b1e3 100644 --- a/test/kepF.cpp +++ b/test/kepF.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include "catch.hpp" #include "test_utils.hpp" @@ -104,6 +106,31 @@ TEST_CASE("kepF diff") } } +TEST_CASE("kepF s11n") +{ + std::stringstream ss; + + auto [x, y, z] = make_vars("x", "y", "z"); + + auto ex = kepF(x, y, z); + + { + boost::archive::binary_oarchive oa(ss); + + oa << ex; + } + + ex = 0_dbl; + + { + boost::archive::binary_iarchive ia(ss); + + ia >> ex; + } + + REQUIRE(ex == kepF(x, y, z)); +} + TEST_CASE("cfunc") { using std::isnan;