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/integer.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/integer.cc')
| -rw-r--r-- | nihil.ucl/tests/integer.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/nihil.ucl/tests/integer.cc b/nihil.ucl/tests/integer.cc index da119e6..c7db851 100644 --- a/nihil.ucl/tests/integer.cc +++ b/nihil.ucl/tests/integer.cc @@ -10,20 +10,36 @@ import nihil.ucl; TEST_CASE("ucl: integer: construct", "[ucl]") { - auto obj = nihil::ucl::integer(42); - REQUIRE(object_cast<nihil::ucl::integer>(obj).value() == 42); + auto i = nihil::ucl::integer(42); + REQUIRE(i == 42); } -TEST_CASE("ucl: integer: compare", "[ucl]") +TEST_CASE("ucl: integer: default construct", "[ucl]") +{ + auto i = nihil::ucl::integer(); + REQUIRE(i == 0); +} + +TEST_CASE("ucl: integer: operator==", "[ucl]") { auto i = nihil::ucl::integer(42); + REQUIRE(i == 42); REQUIRE(i == nihil::ucl::integer(42)); + + REQUIRE(i != 1); REQUIRE(i != nihil::ucl::integer(1)); - REQUIRE((i == 42) == true); +} + +TEST_CASE("ucl: integer: operator<=>", "[ucl]") +{ + auto i = nihil::ucl::integer(42); + + REQUIRE(i < 43); + REQUIRE(i < nihil::ucl::integer(43)); - REQUIRE(i > nihil::ucl::integer(40)); - REQUIRE(i > 40); + REQUIRE(i > 1); + REQUIRE(i > nihil::ucl::integer(1)); } TEST_CASE("ucl: parse: integer", "[ucl]") |
