diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/tests/unit/misc/unique/test_unique_int.cc | |
Diffstat (limited to 'tiger-compiler/tests/unit/misc/unique/test_unique_int.cc')
| -rw-r--r-- | tiger-compiler/tests/unit/misc/unique/test_unique_int.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tiger-compiler/tests/unit/misc/unique/test_unique_int.cc b/tiger-compiler/tests/unit/misc/unique/test_unique_int.cc new file mode 100644 index 0000000..f25c3c2 --- /dev/null +++ b/tiger-compiler/tests/unit/misc/unique/test_unique_int.cc @@ -0,0 +1,18 @@ +#include <criterion/criterion.h> +#include <criterion/assert.h> +#include <misc/unique.hh> + +Test(unique_int, simple) +{ + misc::unique<int> the_answer = 42; + misc::unique<int> the_same_answer = 42; + misc::unique<int> the_solution = 51; + + cr_expect_eq(the_answer, misc::unique<int>(42)); + cr_expect_eq(the_answer, the_same_answer); + cr_expect_neq(the_answer, the_solution); + + cr_expect_eq(the_answer.get(), the_same_answer.get()); + cr_expect_eq(the_answer.get(), misc::unique<int>(42).get()); + cr_expect_neq(the_answer.get(), the_solution.get()); +} |
