summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/unit/misc/unique/test_unique_char.cc
blob: d69b42c1de6f509b6911bc4e98299fd8f8e3bfc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <criterion/criterion.h>
#include <criterion/assert.h>
#include <misc/unique.hh>

Test(unique_char, simple)
{
  misc::unique<char> the_answer = 'a';
  misc::unique<char> the_same_answer = 'a';
  misc::unique<char> the_solution = 'b';

  cr_expect_eq(the_answer, misc::unique<char>('a'));
  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<char>('a').get());
  cr_expect_neq(the_answer.get(), the_solution.get());
}