diff --git a/tests/unit/base.cc b/tests/unit/base.cc deleted file mode 100644 index 4573678..0000000 --- a/tests/unit/base.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include - -TEST(misc, passing) { - ASSERT_EQ(1, 1); -} diff --git a/tests/unit/bignum.cc b/tests/unit/bignum.cc new file mode 100644 index 0000000..e7dfdc6 --- /dev/null +++ b/tests/unit/bignum.cc @@ -0,0 +1,27 @@ +#include + +#include "bignum.hh" + +using namespace abacus::bignum; + +TEST(BigNum, equality) { + auto const zero = BigNum(0); + auto const one = BigNum(1); + + ASSERT_EQ(zero, zero); + ASSERT_EQ(one, one); + ASSERT_NE(zero, one); +} + +TEST(BigNum, comparisons) { + auto const zero = BigNum(0); + auto const one = BigNum(1); + + ASSERT_LT(zero, one); + ASSERT_LE(zero, one); + ASSERT_LE(zero, zero); + + ASSERT_GT(one, zero); + ASSERT_GE(one, zero); + ASSERT_GE(one, one); +} diff --git a/tests/unit/meson.build b/tests/unit/meson.build index e866754..db8eddd 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -6,13 +6,14 @@ gtest = dependency( if gtest.found() unit_test_sources = files( - 'base.cc', + 'bignum.cc', ) unit_tests = executable( 'unit_tests', sources: unit_test_sources, dependencies: [ + bignum, gtest, ], )