From 822ae21e0b26e9a98b3a5585dbcd2694bbbce685 Mon Sep 17 00:00:00 2001 From: Aina Niemetz Date: Mon, 1 Mar 2021 16:07:25 -0800 Subject: [PATCH] google test: util: Migrate floatingpoint_black. (#6021) --- test/unit/util/CMakeLists.txt | 2 +- ...gpoint_black.h => floatingpoint_black.cpp} | 88 +++++++++---------- 2 files changed, 44 insertions(+), 46 deletions(-) rename test/unit/util/{floatingpoint_black.h => floatingpoint_black.cpp} (70%) diff --git a/test/unit/util/CMakeLists.txt b/test/unit/util/CMakeLists.txt index fb76f49e2..046f4c93e 100644 --- a/test/unit/util/CMakeLists.txt +++ b/test/unit/util/CMakeLists.txt @@ -22,7 +22,7 @@ cvc4_add_unit_test_black(configuration_black util) cvc4_add_unit_test_black(datatype_black util) cvc4_add_unit_test_black(exception_black util) if(CVC4_USE_SYMFPU) -cvc4_add_cxx_unit_test_black(floatingpoint_black util) +cvc4_add_unit_test_black(floatingpoint_black util) endif() cvc4_add_unit_test_black(integer_black util) cvc4_add_unit_test_white(integer_white util) diff --git a/test/unit/util/floatingpoint_black.h b/test/unit/util/floatingpoint_black.cpp similarity index 70% rename from test/unit/util/floatingpoint_black.h rename to test/unit/util/floatingpoint_black.cpp index 4517bcafc..f60fe4a8b 100644 --- a/test/unit/util/floatingpoint_black.h +++ b/test/unit/util/floatingpoint_black.cpp @@ -1,5 +1,5 @@ /********************* */ -/*! \file floatingpoint_black.h +/*! \file floatingpoint_black.cpp ** \verbatim ** Top contributors (to current version): ** Aina Niemetz @@ -13,22 +13,18 @@ ** ** Black box testing of CVC4::FloatingPoint. **/ -#include +#include "test.h" #include "util/floatingpoint.h" -using namespace CVC4; +namespace CVC4 { +namespace test { -class FloatingPointBlack : public CxxTest::TestSuite +class TestUtilBlackFloatingPoint : public TestInternal { - public: - void testMakeMinSubnormal(); - void testMakeMaxSubnormal(); - void testMakeMinNormal(); - void testMakeMaxNormal(); }; -void FloatingPointBlack::testMakeMinSubnormal() +TEST_F(TestUtilBlackFloatingPoint, makeMinSubnormal) { FloatingPointSize size16(5, 11); FloatingPointSize size32(8, 24); @@ -36,27 +32,27 @@ void FloatingPointBlack::testMakeMinSubnormal() FloatingPointSize size128(15, 113); FloatingPoint fp16 = FloatingPoint::makeMinSubnormal(size16, true); - TS_ASSERT(fp16.isSubnormal()); + ASSERT_TRUE(fp16.isSubnormal()); FloatingPoint mfp16 = FloatingPoint::makeMinSubnormal(size16, false); - TS_ASSERT(mfp16.isSubnormal()); + ASSERT_TRUE(mfp16.isSubnormal()); FloatingPoint fp32 = FloatingPoint::makeMinSubnormal(size32, true); - TS_ASSERT(fp32.isSubnormal()); + ASSERT_TRUE(fp32.isSubnormal()); FloatingPoint mfp32 = FloatingPoint::makeMinSubnormal(size32, false); - TS_ASSERT(mfp32.isSubnormal()); + ASSERT_TRUE(mfp32.isSubnormal()); FloatingPoint fp64 = FloatingPoint::makeMinSubnormal(size64, true); - TS_ASSERT(fp64.isSubnormal()); + ASSERT_TRUE(fp64.isSubnormal()); FloatingPoint mfp64 = FloatingPoint::makeMinSubnormal(size64, false); - TS_ASSERT(mfp64.isSubnormal()); + ASSERT_TRUE(mfp64.isSubnormal()); FloatingPoint fp128 = FloatingPoint::makeMinSubnormal(size128, true); - TS_ASSERT(fp128.isSubnormal()); + ASSERT_TRUE(fp128.isSubnormal()); FloatingPoint mfp128 = FloatingPoint::makeMinSubnormal(size128, false); - TS_ASSERT(mfp128.isSubnormal()); + ASSERT_TRUE(mfp128.isSubnormal()); } -void FloatingPointBlack::testMakeMaxSubnormal() +TEST_F(TestUtilBlackFloatingPoint, makeMaxSubnormal) { FloatingPointSize size16(5, 11); FloatingPointSize size32(8, 24); @@ -64,27 +60,27 @@ void FloatingPointBlack::testMakeMaxSubnormal() FloatingPointSize size128(15, 113); FloatingPoint fp16 = FloatingPoint::makeMaxSubnormal(size16, true); - TS_ASSERT(fp16.isSubnormal()); + ASSERT_TRUE(fp16.isSubnormal()); FloatingPoint mfp16 = FloatingPoint::makeMaxSubnormal(size16, false); - TS_ASSERT(mfp16.isSubnormal()); + ASSERT_TRUE(mfp16.isSubnormal()); FloatingPoint fp32 = FloatingPoint::makeMaxSubnormal(size32, true); - TS_ASSERT(fp32.isSubnormal()); + ASSERT_TRUE(fp32.isSubnormal()); FloatingPoint mfp32 = FloatingPoint::makeMaxSubnormal(size32, false); - TS_ASSERT(mfp32.isSubnormal()); + ASSERT_TRUE(mfp32.isSubnormal()); FloatingPoint fp64 = FloatingPoint::makeMaxSubnormal(size64, true); - TS_ASSERT(fp64.isSubnormal()); + ASSERT_TRUE(fp64.isSubnormal()); FloatingPoint mfp64 = FloatingPoint::makeMaxSubnormal(size64, false); - TS_ASSERT(mfp64.isSubnormal()); + ASSERT_TRUE(mfp64.isSubnormal()); FloatingPoint fp128 = FloatingPoint::makeMaxSubnormal(size128, true); - TS_ASSERT(fp128.isSubnormal()); + ASSERT_TRUE(fp128.isSubnormal()); FloatingPoint mfp128 = FloatingPoint::makeMaxSubnormal(size128, false); - TS_ASSERT(mfp128.isSubnormal()); + ASSERT_TRUE(mfp128.isSubnormal()); } -void FloatingPointBlack::testMakeMinNormal() +TEST_F(TestUtilBlackFloatingPoint, makeMinNormal) { FloatingPointSize size16(5, 11); FloatingPointSize size32(8, 24); @@ -92,27 +88,27 @@ void FloatingPointBlack::testMakeMinNormal() FloatingPointSize size128(15, 113); FloatingPoint fp16 = FloatingPoint::makeMinNormal(size16, true); - TS_ASSERT(fp16.isNormal()); + ASSERT_TRUE(fp16.isNormal()); FloatingPoint mfp16 = FloatingPoint::makeMinNormal(size16, false); - TS_ASSERT(mfp16.isNormal()); + ASSERT_TRUE(mfp16.isNormal()); FloatingPoint fp32 = FloatingPoint::makeMinNormal(size32, true); - TS_ASSERT(fp32.isNormal()); + ASSERT_TRUE(fp32.isNormal()); FloatingPoint mfp32 = FloatingPoint::makeMinNormal(size32, false); - TS_ASSERT(mfp32.isNormal()); + ASSERT_TRUE(mfp32.isNormal()); FloatingPoint fp64 = FloatingPoint::makeMinNormal(size64, true); - TS_ASSERT(fp64.isNormal()); + ASSERT_TRUE(fp64.isNormal()); FloatingPoint mfp64 = FloatingPoint::makeMinNormal(size64, false); - TS_ASSERT(mfp64.isNormal()); + ASSERT_TRUE(mfp64.isNormal()); FloatingPoint fp128 = FloatingPoint::makeMinNormal(size128, true); - TS_ASSERT(fp128.isNormal()); + ASSERT_TRUE(fp128.isNormal()); FloatingPoint mfp128 = FloatingPoint::makeMinNormal(size128, false); - TS_ASSERT(mfp128.isNormal()); + ASSERT_TRUE(mfp128.isNormal()); } -void FloatingPointBlack::testMakeMaxNormal() +TEST_F(TestUtilBlackFloatingPoint, makeMaxNormal) { FloatingPointSize size16(5, 11); FloatingPointSize size32(8, 24); @@ -120,22 +116,24 @@ void FloatingPointBlack::testMakeMaxNormal() FloatingPointSize size128(15, 113); FloatingPoint fp16 = FloatingPoint::makeMaxNormal(size16, true); - TS_ASSERT(fp16.isNormal()); + ASSERT_TRUE(fp16.isNormal()); FloatingPoint mfp16 = FloatingPoint::makeMaxNormal(size16, false); - TS_ASSERT(mfp16.isNormal()); + ASSERT_TRUE(mfp16.isNormal()); FloatingPoint fp32 = FloatingPoint::makeMaxNormal(size32, true); - TS_ASSERT(fp32.isNormal()); + ASSERT_TRUE(fp32.isNormal()); FloatingPoint mfp32 = FloatingPoint::makeMaxNormal(size32, false); - TS_ASSERT(mfp32.isNormal()); + ASSERT_TRUE(mfp32.isNormal()); FloatingPoint fp64 = FloatingPoint::makeMaxNormal(size64, true); - TS_ASSERT(fp64.isNormal()); + ASSERT_TRUE(fp64.isNormal()); FloatingPoint mfp64 = FloatingPoint::makeMaxNormal(size64, false); - TS_ASSERT(mfp64.isNormal()); + ASSERT_TRUE(mfp64.isNormal()); FloatingPoint fp128 = FloatingPoint::makeMaxNormal(size128, true); - TS_ASSERT(fp128.isNormal()); + ASSERT_TRUE(fp128.isNormal()); FloatingPoint mfp128 = FloatingPoint::makeMaxNormal(size128, false); - TS_ASSERT(mfp128.isNormal()); + ASSERT_TRUE(mfp128.isNormal()); } +} // namespace test +} // namespace CVC4 -- 2.30.2