From cddb6f7b6d8bf76645f6ee375e71f54232f5170b Mon Sep 17 00:00:00 2001 From: Nick Thompson <4nt@ornl.gov> Date: Tue, 13 Apr 2021 14:37:20 -0400 Subject: [PATCH 1/3] Do not flush the stream when you're just going to convert it to string. --- vtkm/testing/Testing.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vtkm/testing/Testing.h b/vtkm/testing/Testing.h index b6d023e5b..68869ae89 100644 --- a/vtkm/testing/Testing.h +++ b/vtkm/testing/Testing.h @@ -875,8 +875,8 @@ static inline VTKM_CONT void CheckPortal(const PortalType& portal) if (!test_equal(expectedValue, foundValue)) { std::stringstream message; - message << "Got unexpected value in array." << std::endl - << "Expected: " << expectedValue << ", Found: " << foundValue << std::endl; + message << "Got unexpected value in array. Expected: " << expectedValue + << ", Found: " << foundValue << "\n"; VTKM_TEST_FAIL(message.str().c_str()); } } From 384fea5cedc69476cfbb5ada029a3b379b41fadc Mon Sep 17 00:00:00 2001 From: Nick Thompson <4nt@ornl.gov> Date: Tue, 13 Apr 2021 16:00:23 -0400 Subject: [PATCH 2/3] Make sure arguments are placed in correct order. --- vtkm/testing/Testing.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vtkm/testing/Testing.h b/vtkm/testing/Testing.h index 68869ae89..93be56077 100644 --- a/vtkm/testing/Testing.h +++ b/vtkm/testing/Testing.h @@ -378,8 +378,8 @@ public: static VTKM_CONT void Assert(const std::string& conditionString, const std::string& file, - const char* func, vtkm::Id line, + const char* func, bool condition) { Assert(conditionString, file, line, func, condition, "Test assertion failed"); @@ -387,8 +387,8 @@ public: static VTKM_CONT void Assert(const std::string& conditionString, const std::string& file, - const char* func, vtkm::Id line, + const char* func, const TestEqualResult& result) { Assert(conditionString, file, line, func, static_cast(result), result.GetMergedMessage()); From 82361fc45e521293ff2183967bd1a60b2b84c265 Mon Sep 17 00:00:00 2001 From: Nick Thompson <4nt@ornl.gov> Date: Tue, 13 Apr 2021 19:09:55 -0400 Subject: [PATCH 3/3] Better message on failure for DifferenceOfProducts. --- vtkm/testing/UnitTestMath.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vtkm/testing/UnitTestMath.cxx b/vtkm/testing/UnitTestMath.cxx index 7539f1dd9..868c4a8ba 100644 --- a/vtkm/testing/UnitTestMath.cxx +++ b/vtkm/testing/UnitTestMath.cxx @@ -856,10 +856,10 @@ struct ScalarVectorFieldTests : public vtkm::exec::FunctorBase vtkm::UInt64 dist = vtkm::FloatDistance(expected, computed); VTKM_MATH_ASSERT( dist < 2, - "Float distance for difference of products is which exceeds 1.5; this is in violation of a " - "theorem " - "proved by Jeannerod in doi.org/10.1090/S0025-5718-2013-02679-8. Is your build compiled " - "with FMAs enabled?"); + "Float distance for difference of products is " + std::to_string(dist) + + " which exceeds 1.5; this is in violation of a theorem " + "proved by Jeannerod in doi.org/10.1090/S0025-5718-2013-02679-8. Is your build compiled " + "with FMAs enabled?"); #endif }