summaryrefslogtreecommitdiff
path: root/modules/core/tests/core.cpp
blob: 12fc398595d2be9fb2f70f3671980942088af656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "../c++/test/suite.hpp"
#include "../c++/id.hpp"
#include "../c++/string_literal.hpp"
#include "../c++/reduce_templates.hpp"

namespace {
SAW_TEST("ID functionality") {
		using namespace saw;
		struct foo {};

		id<foo> a{1};
		id<foo> b{1};
		id<foo> c{2};

		/** 
		 * The following doesn't compile, so it's commented out as an example
		 */
		/**
		 * struct bar {};
		 *
		 * id<bar> d{1};
		 *
		 * SAW_EXPECT(a == d, "Shouldn't compile");
		 */

		SAW_EXPECT(a == b, "Should be equal");
		SAW_EXPECT(a != c, "Shouldn't be equal");
		SAW_EXPECT(b != c, "Shouldn't be equal");
		SAW_EXPECT(a.get_value() == 1, "Lost original value");
}

SAW_TEST("String Literal Append"){
		using namespace saw;

		constexpr string_literal a = "foo";
		constexpr string_literal b = "bar";
		constexpr string_literal c = a+b;

		SAW_EXPECT(c == "foobar", "CT String sum is not \"foobar\"");
}
}