summaryrefslogtreecommitdiffstats
path: root/StringTools/Test/test.cpp
diff options
context:
space:
mode:
authorLeonetienne <leonetienne@hotmail.de>2022-02-11 01:32:43 +0100
committerLeonetienne <leonetienne@hotmail.de>2022-02-11 01:32:43 +0100
commita516b3aa6f6906d6780172d684e91fa4b7d3cdd1 (patch)
tree8cea43809112a3b1314d1da23fa1935b02c8d81e /StringTools/Test/test.cpp
parente3932dbdceb841961e7ad889c4e290e00d268018 (diff)
Switched to Catch2 testing framework
Diffstat (limited to 'StringTools/Test/test.cpp')
-rw-r--r--StringTools/Test/test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/StringTools/Test/test.cpp b/StringTools/Test/test.cpp
new file mode 100644
index 0000000..80b7166
--- /dev/null
+++ b/StringTools/Test/test.cpp
@@ -0,0 +1,21 @@
+#define CATCH_CONFIG_MAIN
+#include "Catch2.h"
+
+int Add(int a, int b)
+{
+ return a+b;
+}
+
+TEST_CASE("Add works with zeroes", "[add]")
+{
+ REQUIRE(Add(0, 0) == 0);
+ REQUIRE(Add(5, 0) == 5);
+ REQUIRE(Add(0, 5) == 5);
+}
+
+TEST_CASE("Add works with negatives", "[add]")
+{
+ REQUIRE(Add(-5, 0) == -5);
+ REQUIRE(Add(0, -5) == -5);
+ REQUIRE(Add(-5, -5) == -10);
+}