From a516b3aa6f6906d6780172d684e91fa4b7d3cdd1 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Fri, 11 Feb 2022 01:32:43 +0100 Subject: Switched to Catch2 testing framework --- StringTools/Test/test.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 StringTools/Test/test.cpp (limited to 'StringTools/Test/test.cpp') 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); +} -- cgit v1.2.3