diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-22 18:18:44 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-22 18:18:44 +0100 |
| commit | 639b270eed81f7c2627d810057d188e2e8ee67f9 (patch) | |
| tree | 7b8f7628b799dba307f06cf813583d42bdc1838a /nihil.ucl/tests/real.cc | |
| parent | 09b7a494bd5de24f380095003fb7da4939de43e5 (diff) | |
| download | nihil-639b270eed81f7c2627d810057d188e2e8ee67f9.tar.gz nihil-639b270eed81f7c2627d810057d188e2e8ee67f9.tar.bz2 | |
nihil.ucl: improve construction and comparison
Diffstat (limited to 'nihil.ucl/tests/real.cc')
| -rw-r--r-- | nihil.ucl/tests/real.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/nihil.ucl/tests/real.cc b/nihil.ucl/tests/real.cc index 275684a..d97e767 100644 --- a/nihil.ucl/tests/real.cc +++ b/nihil.ucl/tests/real.cc @@ -16,16 +16,32 @@ TEST_CASE("ucl: real: construct", "[ucl]") Catch::Matchers::WithinRel(42.1)); } -TEST_CASE("ucl: real: compare", "[ucl]") +TEST_CASE("ucl: real: default construct", "[ucl]") { - auto i = nihil::ucl::real(42); + auto i = nihil::ucl::real(); + REQUIRE(i == 0); +} + +TEST_CASE("ucl: real: operator==", "[ucl]") +{ + auto i = nihil::ucl::real(42.5); + + REQUIRE(i == 42.5); + REQUIRE(i == nihil::ucl::real(42.5)); - REQUIRE(i == nihil::ucl::real(42)); + REQUIRE(i != 1); REQUIRE(i != nihil::ucl::real(1)); - REQUIRE((i == 42) == true); +} + +TEST_CASE("ucl: real: operator<=>", "[ucl]") +{ + auto i = nihil::ucl::real(42.5); + + REQUIRE(i < 43); + REQUIRE(i < nihil::ucl::real(43)); - REQUIRE(i > nihil::ucl::real(40)); - REQUIRE(i > 40); + REQUIRE(i > 1); + REQUIRE(i > nihil::ucl::real(1)); } TEST_CASE("ucl: real: parse", "[ucl]") |
