diff options
Diffstat (limited to 'src/tests/catchy/test_bigint.cpp')
-rw-r--r-- | src/tests/catchy/test_bigint.cpp | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/tests/catchy/test_bigint.cpp b/src/tests/catchy/test_bigint.cpp index 7ea2d6370..67821eaf0 100644 --- a/src/tests/catchy/test_bigint.cpp +++ b/src/tests/catchy/test_bigint.cpp @@ -1,9 +1,7 @@ // (C) 2015 Simon Warta (Kullo GmbH) // Botan is released under the Simplified BSD License (see license.txt) -#include "catch.hpp" - -#include <botan/build.h> +#include "catchy_tests.h" #if defined(BOTAN_HAS_BIGINT) @@ -16,57 +14,57 @@ TEST_CASE("Bigint basics", "[bigint]") SECTION("in 0-bit border") { BigInt a(0u); - CHECK(( a.bits() == 0 )); - CHECK(( a.bytes() == 0 )); - CHECK(( a.to_u32bit() == 0 )); + CHECK_THAT(a.bits(), Equals(0)); + CHECK_THAT(a.bytes(), Equals(0)); + CHECK_THAT(a.to_u32bit(), Equals(0)); } SECTION("above 0-bit border") { BigInt a(1u); - CHECK(( a.bits() == 1 )); - CHECK(( a.bytes() == 1 )); - CHECK(( a.to_u32bit() == 1 )); + CHECK_THAT(a.bits(), Equals(1)); + CHECK_THAT(a.bytes(), Equals(1)); + CHECK_THAT(a.to_u32bit(), Equals(1)); } SECTION("in 8-bit border") { BigInt a(255u); - CHECK(( a.bits() == 8 )); - CHECK(( a.bytes() == 1 )); - CHECK(( a.to_u32bit() == 255 )); + CHECK_THAT(a.bits(), Equals(8)); + CHECK_THAT(a.bytes(), Equals(1)); + CHECK_THAT(a.to_u32bit(), Equals(255)); } SECTION("above 8-bit border") { BigInt a(256u); - CHECK(( a.bits() == 9 )); - CHECK(( a.bytes() == 2 )); - CHECK(( a.to_u32bit() == 256 )); + CHECK_THAT(a.bits(), Equals(9)); + CHECK_THAT(a.bytes(), Equals(2)); + CHECK_THAT(a.to_u32bit(), Equals(256)); } SECTION("in 16-bit border") { BigInt a(65535u); - CHECK(( a.bits() == 16 )); - CHECK(( a.bytes() == 2 )); - CHECK(( a.to_u32bit() == 65535 )); + CHECK_THAT(a.bits(), Equals(16)); + CHECK_THAT(a.bytes(), Equals(2)); + CHECK_THAT(a.to_u32bit(), Equals(65535)); } SECTION("above 16-bit border") { BigInt a(65536u); - CHECK(( a.bits() == 17 )); - CHECK(( a.bytes() == 3 )); - CHECK(( a.to_u32bit() == 65536 )); + CHECK_THAT(a.bits(), Equals(17)); + CHECK_THAT(a.bytes(), Equals(3)); + CHECK_THAT(a.to_u32bit(), Equals(65536)); } SECTION("in 32-bit border") { BigInt a(4294967295u); - CHECK(( a.bits() == 32 )); - CHECK(( a.bytes() == 4 )); - CHECK(( a.to_u32bit() == 4294967295u )); + CHECK_THAT(a.bits(), Equals(32)); + CHECK_THAT(a.bytes(), Equals(4)); + CHECK_THAT(a.to_u32bit(), Equals(4294967295u)); } SECTION("above 32-bit border") { BigInt a(4294967296u); - CHECK(( a.bits() == 33 )); - CHECK(( a.bytes() == 5 )); + CHECK_THAT(a.bits(), Equals(33)); + CHECK_THAT(a.bytes(), Equals(5)); CHECK_THROWS( a.to_u32bit() ); } } |