From 72da68ebf30bdadc1a340c9a6220745d3a32e611 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 8 Jan 2025 12:44:39 -0500 Subject: [PATCH 01/11] platform specific #ifs --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 32 ++++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index 989694b269..bf035de679 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -552,19 +552,25 @@ TEST(HybridBayesNet, Sampling) { EXPECT_LONGS_EQUAL(2, average_continuous.size()); EXPECT_LONGS_EQUAL(num_samples, discrete_samples.size()); - // Regressions don't work across platforms :-( - // // regression for specific RNG seed - // double discrete_sum = - // std::accumulate(discrete_samples.begin(), discrete_samples.end(), - // decltype(discrete_samples)::value_type(0)); - // EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); - - // VectorValues expected; - // expected.insert({X(0), Vector1(-0.0131207162712)}); - // expected.insert({X(1), Vector1(-0.499026377568)}); - // // regression for specific RNG seed - // EXPECT(assert_equal(expected, average_continuous.scale(1.0 / - // num_samples))); + // regression for specific RNG seed + double discrete_sum = + std::accumulate(discrete_samples.begin(), discrete_samples.end(), + decltype(discrete_samples)::value_type(0)); +#if __APPLE__ + EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); +#elif __linux__ + EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); +#endif + + VectorValues expected; + expected.insert({X(0), Vector1(-0.0131207162712)}); + expected.insert({X(1), Vector1(-0.499026377568)}); + // regression for specific RNG seed +#if __APPLE__ + EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); +#elif __linux__ + EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); +#endif } /* ****************************************************************************/ From c00f6631adaa7c85876249cfc986f959fde1addc Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 8 Jan 2025 12:52:44 -0500 Subject: [PATCH 02/11] other tests --- gtsam/linear/tests/testGaussianBayesNet.cpp | 12 +++++++++--- gtsam/linear/tests/testGaussianConditional.cpp | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gtsam/linear/tests/testGaussianBayesNet.cpp b/gtsam/linear/tests/testGaussianBayesNet.cpp index b1cfbe12ca..ccc58d3ff6 100644 --- a/gtsam/linear/tests/testGaussianBayesNet.cpp +++ b/gtsam/linear/tests/testGaussianBayesNet.cpp @@ -186,9 +186,15 @@ TEST(GaussianBayesNet, sample) { std::mt19937_64 rng(4242); auto actual3 = gbn.sample(&rng); EXPECT_LONGS_EQUAL(2, actual.size()); - // regression is not repeatable across platforms/versions :-( - // EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); - // EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); + + // regressions +#ifdef __APPLE__ + EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); + EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); +#elif __linux__ + EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); + EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); +#endif } /* ************************************************************************* */ diff --git a/gtsam/linear/tests/testGaussianConditional.cpp b/gtsam/linear/tests/testGaussianConditional.cpp index 68894c3142..b445443480 100644 --- a/gtsam/linear/tests/testGaussianConditional.cpp +++ b/gtsam/linear/tests/testGaussianConditional.cpp @@ -464,8 +464,12 @@ TEST(GaussianConditional, sample) { std::mt19937_64 rng(4242); auto actual3 = conditional.sample(given, &rng); EXPECT_LONGS_EQUAL(1, actual2.size()); - // regression is not repeatable across platforms/versions :-( - // EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); + // regressions +#ifdef __APPLE__ + EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); +#elif __linux__ + EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); +#endif } /* ************************************************************************* */ From 212c79289f0877c7ef9222351728ebca563761e8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 8 Jan 2025 12:57:30 -0500 Subject: [PATCH 03/11] support Windows --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 4 ++++ gtsam/linear/tests/testGaussianBayesNet.cpp | 3 +++ gtsam/linear/tests/testGaussianConditional.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index bf035de679..127160ab62 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -560,6 +560,8 @@ TEST(HybridBayesNet, Sampling) { EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); #elif __linux__ EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); +#elif _WIN32 + EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); #endif VectorValues expected; @@ -570,6 +572,8 @@ TEST(HybridBayesNet, Sampling) { EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); #elif __linux__ EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); +#elif _WIN32 + EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); #endif } diff --git a/gtsam/linear/tests/testGaussianBayesNet.cpp b/gtsam/linear/tests/testGaussianBayesNet.cpp index ccc58d3ff6..570296e8b7 100644 --- a/gtsam/linear/tests/testGaussianBayesNet.cpp +++ b/gtsam/linear/tests/testGaussianBayesNet.cpp @@ -194,6 +194,9 @@ TEST(GaussianBayesNet, sample) { #elif __linux__ EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); +#elif _WIN32 + EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); + EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); #endif } diff --git a/gtsam/linear/tests/testGaussianConditional.cpp b/gtsam/linear/tests/testGaussianConditional.cpp index b445443480..2213ae8728 100644 --- a/gtsam/linear/tests/testGaussianConditional.cpp +++ b/gtsam/linear/tests/testGaussianConditional.cpp @@ -469,6 +469,8 @@ TEST(GaussianConditional, sample) { EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); #elif __linux__ EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); +#elif _WIN32 + EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); #endif } From d9106fd19083cdc8b900c991cc4e104be009706a Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 8 Jan 2025 13:32:34 -0500 Subject: [PATCH 04/11] add numeric header for std::accumulate --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index 127160ab62..5f54c57b6e 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -34,6 +34,7 @@ #include #include +#include using namespace std; using namespace gtsam; From 41280d4d1e32a2545d18e7a6500f22a42ad36736 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 8 Jan 2025 18:33:46 -0500 Subject: [PATCH 05/11] update tests that failed and add shonan averaging test --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 16 ++++++-------- gtsam/linear/tests/testGaussianBayesNet.cpp | 4 ++-- .../linear/tests/testGaussianConditional.cpp | 8 +++---- gtsam/sfm/tests/testShonanAveraging.cpp | 22 ++++++++++++------- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index 5f54c57b6e..a5bea4292a 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -557,25 +557,23 @@ TEST(HybridBayesNet, Sampling) { double discrete_sum = std::accumulate(discrete_samples.begin(), discrete_samples.end(), decltype(discrete_samples)::value_type(0)); -#if __APPLE__ +#if __APPLE__ || _WIN32 EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); #elif __linux__ EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); -#elif _WIN32 - EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); #endif VectorValues expected; + // regression for specific RNG seed +#if __APPLE__ || _WIN32 expected.insert({X(0), Vector1(-0.0131207162712)}); expected.insert({X(1), Vector1(-0.499026377568)}); - // regression for specific RNG seed -#if __APPLE__ - EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); #elif __linux__ - EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); -#elif _WIN32 - EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); + expected.insert({X(0), Vector1(-0.00799425)}); + expected.insert({X(1), Vector1(-0.526464)}); #endif + + EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); } /* ****************************************************************************/ diff --git a/gtsam/linear/tests/testGaussianBayesNet.cpp b/gtsam/linear/tests/testGaussianBayesNet.cpp index 570296e8b7..32534a1e7a 100644 --- a/gtsam/linear/tests/testGaussianBayesNet.cpp +++ b/gtsam/linear/tests/testGaussianBayesNet.cpp @@ -192,8 +192,8 @@ TEST(GaussianBayesNet, sample) { EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); #elif __linux__ - EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); - EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); + EXPECT(assert_equal(Vector2(20.0070499, 39.9942591), actual[X(1)], 1e-5)); + EXPECT(assert_equal(Vector2(109.976501, 229.990945), actual[X(0)], 1e-5)); #elif _WIN32 EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); diff --git a/gtsam/linear/tests/testGaussianConditional.cpp b/gtsam/linear/tests/testGaussianConditional.cpp index 2213ae8728..ad6a8ffe20 100644 --- a/gtsam/linear/tests/testGaussianConditional.cpp +++ b/gtsam/linear/tests/testGaussianConditional.cpp @@ -465,12 +465,10 @@ TEST(GaussianConditional, sample) { auto actual3 = conditional.sample(given, &rng); EXPECT_LONGS_EQUAL(1, actual2.size()); // regressions -#ifdef __APPLE__ +#if __APPLE__ || _WIN32 EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); #elif __linux__ - EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); -#elif _WIN32 - EXPECT(assert_equal(Vector2(31.0111856, 64.9850775), actual2[X(0)], 1e-5)); + EXPECT(assert_equal(Vector2(30.9809331, 64.9927588), actual2[X(0)], 1e-5)); #endif } @@ -523,7 +521,7 @@ TEST(GaussianConditional, Print) { " d = [ 20 40 ]\n" " mean: 1 elements\n" " x0: 20 40\n" - " logNormalizationConstant: -4.0351\n" + " logNormalizationConstant: -4.03510164\n" "isotropic dim=2 sigma=3\n"; EXPECT(assert_print_equal(expected, conditional, "GaussianConditional")); diff --git a/gtsam/sfm/tests/testShonanAveraging.cpp b/gtsam/sfm/tests/testShonanAveraging.cpp index dfa725ab6d..63b4eae5cd 100644 --- a/gtsam/sfm/tests/testShonanAveraging.cpp +++ b/gtsam/sfm/tests/testShonanAveraging.cpp @@ -205,14 +205,20 @@ TEST(ShonanAveraging3, CheckWithEigen) { ShonanAveraging3::LiftwithDescent(4, Qstar3, descentDirection); EXPECT_LONGS_EQUAL(5, initialQ4.size()); - // TODO(frank): uncomment this regression test: currently not repeatable - // across platforms. - // Matrix expected(4, 4); - // expected << 0.0459224, -0.688689, -0.216922, 0.690321, // - // 0.92381, 0.191931, 0.255854, 0.21042, // - // -0.376669, 0.301589, 0.687953, 0.542111, // - // -0.0508588, 0.630804, -0.643587, 0.43046; - // EXPECT(assert_equal(SOn(expected), initialQ4.at(0), 1e-5)); + Matrix expected(4, 4); +#if __APPLE__ || _WIN32 + expected << 0.0459224, -0.688689, -0.216922, 0.690321, // + 0.92381, 0.191931, 0.255854, 0.21042, // + -0.376669, 0.301589, 0.687953, 0.542111, // + -0.0508588, 0.630804, -0.643587, 0.43046; +#elif __linux__ + expected << 0.0459224, -0.688689, -0.216922, 0.690321, // + 0.92381, 0.191931, 0.255854, 0.21042, // + -0.376669, 0.301589, 0.687953, 0.542111, // + -0.0508588, 0.630804, -0.643587, 0.43046; +#endif + + EXPECT(assert_equal(SOn(expected), initialQ4.at(0), 1e-5)); } /* ************************************************************************* */ From d4726cfd1f15efaead1a32f15fbb1ed309cdaaae Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 9 Jan 2025 08:57:45 -0500 Subject: [PATCH 06/11] fix some regressions --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 2 ++ gtsam/linear/tests/testGaussianConditional.cpp | 2 +- gtsam/sfm/tests/testShonanAveraging.cpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index a5bea4292a..6b69e11984 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -573,6 +573,8 @@ TEST(HybridBayesNet, Sampling) { expected.insert({X(1), Vector1(-0.526464)}); #endif + std::cout << std::setprecision(12); + average_continuous.scale(1.0 / num_samples).print(); EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); } diff --git a/gtsam/linear/tests/testGaussianConditional.cpp b/gtsam/linear/tests/testGaussianConditional.cpp index ad6a8ffe20..0252368eae 100644 --- a/gtsam/linear/tests/testGaussianConditional.cpp +++ b/gtsam/linear/tests/testGaussianConditional.cpp @@ -521,7 +521,7 @@ TEST(GaussianConditional, Print) { " d = [ 20 40 ]\n" " mean: 1 elements\n" " x0: 20 40\n" - " logNormalizationConstant: -4.03510164\n" + " logNormalizationConstant: -4.0351\n" "isotropic dim=2 sigma=3\n"; EXPECT(assert_print_equal(expected, conditional, "GaussianConditional")); diff --git a/gtsam/sfm/tests/testShonanAveraging.cpp b/gtsam/sfm/tests/testShonanAveraging.cpp index 63b4eae5cd..4ea30c9e87 100644 --- a/gtsam/sfm/tests/testShonanAveraging.cpp +++ b/gtsam/sfm/tests/testShonanAveraging.cpp @@ -207,15 +207,15 @@ TEST(ShonanAveraging3, CheckWithEigen) { Matrix expected(4, 4); #if __APPLE__ || _WIN32 - expected << 0.0459224, -0.688689, -0.216922, 0.690321, // - 0.92381, 0.191931, 0.255854, 0.21042, // - -0.376669, 0.301589, 0.687953, 0.542111, // - -0.0508588, 0.630804, -0.643587, 0.43046; + expected << 0.145767, -0.938445, 0.135713, -0.282233, // + 0.780348, -0.0104323, 0.266238, 0.565743, // + -0.383624, 0.0434887, 0.917211, 0.0983088, // + -0.471849, -0.342523, -0.263482, 0.768514; #elif __linux__ - expected << 0.0459224, -0.688689, -0.216922, 0.690321, // - 0.92381, 0.191931, 0.255854, 0.21042, // - -0.376669, 0.301589, 0.687953, 0.542111, // - -0.0508588, 0.630804, -0.643587, 0.43046; + expected << 0.100724, -0.987231, 0.104092, 0.0662867, // + 0.571527, 0.0292782, 0.226546, -0.788147, // + -0.349294, 0.064102, 0.93465, 0.0177471, // + 0.735667, 0.142857, 0.253519, 0.611649; #endif EXPECT(assert_equal(SOn(expected), initialQ4.at(0), 1e-5)); From cb2be68d051473448cc6b66694cc678f4034eea3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 9 Jan 2025 09:28:06 -0500 Subject: [PATCH 07/11] fix test with better precision --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index 6b69e11984..c313708f43 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -569,12 +569,10 @@ TEST(HybridBayesNet, Sampling) { expected.insert({X(0), Vector1(-0.0131207162712)}); expected.insert({X(1), Vector1(-0.499026377568)}); #elif __linux__ - expected.insert({X(0), Vector1(-0.00799425)}); - expected.insert({X(1), Vector1(-0.526464)}); + expected.insert({X(0), Vector1(-0.00799425182219)}); + expected.insert({X(1), Vector1(-0.526463854268)}); #endif - std::cout << std::setprecision(12); - average_continuous.scale(1.0 / num_samples).print(); EXPECT(assert_equal(expected, average_continuous.scale(1.0 / num_samples))); } From 556ed9bfcc55888a14855a68cbaf385b3282f26b Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 9 Jan 2025 09:31:12 -0500 Subject: [PATCH 08/11] separate Windows regression for Shonan Averaging --- gtsam/sfm/tests/testShonanAveraging.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gtsam/sfm/tests/testShonanAveraging.cpp b/gtsam/sfm/tests/testShonanAveraging.cpp index 4ea30c9e87..e297678b8e 100644 --- a/gtsam/sfm/tests/testShonanAveraging.cpp +++ b/gtsam/sfm/tests/testShonanAveraging.cpp @@ -206,7 +206,7 @@ TEST(ShonanAveraging3, CheckWithEigen) { EXPECT_LONGS_EQUAL(5, initialQ4.size()); Matrix expected(4, 4); -#if __APPLE__ || _WIN32 +#if __APPLE__ expected << 0.145767, -0.938445, 0.135713, -0.282233, // 0.780348, -0.0104323, 0.266238, 0.565743, // -0.383624, 0.0434887, 0.917211, 0.0983088, // @@ -216,6 +216,11 @@ TEST(ShonanAveraging3, CheckWithEigen) { 0.571527, 0.0292782, 0.226546, -0.788147, // -0.349294, 0.064102, 0.93465, 0.0177471, // 0.735667, 0.142857, 0.253519, 0.611649; +#elif _WIN32 + expected << 0.0825862, -0.645931, 0.271896, 0.708537, // + 0.927285, -0.0156335, 0.291603, -0.234236, // + -0.36419, -0.132115, 0.831933, -0.39724, // + 0.0262425, 0.751715, 0.385912, 0.534143; #endif EXPECT(assert_equal(SOn(expected), initialQ4.at(0), 1e-5)); From 438bead4fdf1a04ab598c29fa1846436510d9dca Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 9 Jan 2025 10:45:23 -0500 Subject: [PATCH 09/11] small cleanup --- gtsam/hybrid/tests/testHybridBayesNet.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gtsam/hybrid/tests/testHybridBayesNet.cpp b/gtsam/hybrid/tests/testHybridBayesNet.cpp index c313708f43..784d9c95f6 100644 --- a/gtsam/hybrid/tests/testHybridBayesNet.cpp +++ b/gtsam/hybrid/tests/testHybridBayesNet.cpp @@ -557,11 +557,7 @@ TEST(HybridBayesNet, Sampling) { double discrete_sum = std::accumulate(discrete_samples.begin(), discrete_samples.end(), decltype(discrete_samples)::value_type(0)); -#if __APPLE__ || _WIN32 - EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); -#elif __linux__ EXPECT_DOUBLES_EQUAL(0.477, discrete_sum / num_samples, 1e-9); -#endif VectorValues expected; // regression for specific RNG seed From fbe4ad1dc92a952c6529dfdde11be2ac3800663f Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 10 Jan 2025 10:29:58 -0500 Subject: [PATCH 10/11] common Apple and Windows assertions --- gtsam/linear/tests/testGaussianBayesNet.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gtsam/linear/tests/testGaussianBayesNet.cpp b/gtsam/linear/tests/testGaussianBayesNet.cpp index 32534a1e7a..6e45765410 100644 --- a/gtsam/linear/tests/testGaussianBayesNet.cpp +++ b/gtsam/linear/tests/testGaussianBayesNet.cpp @@ -188,15 +188,12 @@ TEST(GaussianBayesNet, sample) { EXPECT_LONGS_EQUAL(2, actual.size()); // regressions -#ifdef __APPLE__ +#ifdef __APPLE__ || _WIN32 EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); #elif __linux__ EXPECT(assert_equal(Vector2(20.0070499, 39.9942591), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(109.976501, 229.990945), actual[X(0)], 1e-5)); -#elif _WIN32 - EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); - EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); #endif } From 62b0ed6678ae4fdbdb583fa615ad7fdde5c143bc Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 10 Jan 2025 11:11:03 -0500 Subject: [PATCH 11/11] change from ifdef to if --- gtsam/linear/tests/testGaussianBayesNet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/linear/tests/testGaussianBayesNet.cpp b/gtsam/linear/tests/testGaussianBayesNet.cpp index 6e45765410..587597cf14 100644 --- a/gtsam/linear/tests/testGaussianBayesNet.cpp +++ b/gtsam/linear/tests/testGaussianBayesNet.cpp @@ -188,7 +188,7 @@ TEST(GaussianBayesNet, sample) { EXPECT_LONGS_EQUAL(2, actual.size()); // regressions -#ifdef __APPLE__ || _WIN32 +#if __APPLE__ || _WIN32 EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5)); EXPECT(assert_equal(Vector2(110.032083, 230.039811), actual[X(0)], 1e-5)); #elif __linux__