From ef8f573757e7bd1ba86a1e09edd295ba14a7b7e0 Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Thu, 8 Feb 2024 18:12:39 +0100 Subject: [PATCH] Added operation handler unittest for operation input --- test/test_operationHandler.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/test_operationHandler.c diff --git a/test/test_operationHandler.c b/test/test_operationHandler.c new file mode 100644 index 0000000..0a33c4a --- /dev/null +++ b/test/test_operationHandler.c @@ -0,0 +1,28 @@ +#include "../src/operationHandler.h" +#include "unity.h" + +void setUp(void) { + // set stuff up here +} + +void tearDown(void) { + // clean stuff up here +} + +void test_operationHandler_truereturnvaluewithvalidinput(void) { + int expectedResult = 1; + int result1 = checkOperationInput(1); + int result2 = checkOperationInput(2); + int result3 = checkOperationInput(3); + int result4 = checkOperationInput(4); + TEST_ASSERT_EQUAL_INT(expectedResult, result1); + TEST_ASSERT_EQUAL_INT(expectedResult, result2); + TEST_ASSERT_EQUAL_INT(expectedResult, result3); + TEST_ASSERT_EQUAL_INT(expectedResult, result4); +} + +void test_operationHandler_falsereturnvaluewithinvalidinput(void) { + int expectedResult = 0; + int result = checkOperationInput(8); + TEST_ASSERT_EQUAL_INT(expectedResult, result); +} \ No newline at end of file