summary refs log tree commit diff stats
path: root/c/hello-world/test/test_hello_world.c
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-08-11 15:26:15 +0530
committerAndinus <andinus@nand.sh>2021-08-11 15:26:15 +0530
commit321825828ac918bad28d0597a8616c6dc9802c3c (patch)
tree0b8e9cb1012197750eb58e972736319b2a6abac2 /c/hello-world/test/test_hello_world.c
parent2979ef790ac5b8f58495e0dd08cafd6a3a2e30a5 (diff)
downloadexercism-321825828ac918bad28d0597a8616c6dc9802c3c.tar.gz
Add solved exercises
Diffstat (limited to 'c/hello-world/test/test_hello_world.c')
-rw-r--r--c/hello-world/test/test_hello_world.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/c/hello-world/test/test_hello_world.c b/c/hello-world/test/test_hello_world.c
new file mode 100644
index 0000000..8ee371a
--- /dev/null
+++ b/c/hello-world/test/test_hello_world.c
@@ -0,0 +1,35 @@
+// Include the test framework.
+#include "vendor/unity.h"
+
+// Include the header file with the declarations of the functions you create.
+#include "../src/hello_world.h"
+
+// Runs before every test.
+void setUp(void)
+{
+}
+
+// Runs after every test.
+void tearDown(void)
+{
+}
+
+// Defines a single test.
+static void test_say_hi(void)
+{
+   // Check if the 'hello()' function returns "Hello, World!"
+   // This test is expected to fail after first downloading this exercise.
+   // To make this test pass, fix the 'hello()' function definition in the
+   // source file src/hello_world.c.
+   TEST_ASSERT_EQUAL_STRING("Hello, World!", hello());
+}
+
+// Runs the test(s)
+int main(void)
+{
+   UnityBegin("test/test_hello_world.c");
+
+   RUN_TEST(test_say_hi);
+
+   return UnityEnd();
+}