summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/unit/misc/symbol
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/tests/unit/misc/symbol
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/tests/unit/misc/symbol')
-rw-r--r--tiger-compiler/tests/unit/misc/symbol/local.am2
-rw-r--r--tiger-compiler/tests/unit/misc/symbol/test_symbol_simple.cc21
2 files changed, 23 insertions, 0 deletions
diff --git a/tiger-compiler/tests/unit/misc/symbol/local.am b/tiger-compiler/tests/unit/misc/symbol/local.am
new file mode 100644
index 0000000..fbc4825
--- /dev/null
+++ b/tiger-compiler/tests/unit/misc/symbol/local.am
@@ -0,0 +1,2 @@
+check_unit_SOURCES += \
+ %D%/test_symbol_simple.cc
diff --git a/tiger-compiler/tests/unit/misc/symbol/test_symbol_simple.cc b/tiger-compiler/tests/unit/misc/symbol/test_symbol_simple.cc
new file mode 100644
index 0000000..a49ed27
--- /dev/null
+++ b/tiger-compiler/tests/unit/misc/symbol/test_symbol_simple.cc
@@ -0,0 +1,21 @@
+#include <criterion/criterion.h>
+#include <criterion/assert.h>
+#include <misc/symbol.hh>
+
+Test(test_symbol, simple)
+{
+ const misc::symbol toto1("toto");
+ const misc::symbol toto2("toto");
+ const misc::symbol titi1("titi");
+
+ cr_expect_eq(toto1, "toto");
+ cr_expect_neq(toto1, "titi");
+
+ cr_expect_eq(toto1, toto2);
+ cr_expect_neq(toto1, titi1);
+
+ std::string junk = "tata";
+ const misc::symbol tata1(junk);
+ junk = "toto";
+ cr_expect_eq(tata1, "tata");
+}