From 57f159cd96bcb3ec90a58fb6615d79454e715c36 Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Thu, 8 Feb 2024 18:18:56 +0100 Subject: [PATCH] Added multiple tests for operation handler input processing --- test/test_operationHandler.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/test_operationHandler.c b/test/test_operationHandler.c index 0a33c4a..1cdfb1d 100644 --- a/test/test_operationHandler.c +++ b/test/test_operationHandler.c @@ -25,4 +25,25 @@ void test_operationHandler_falsereturnvaluewithinvalidinput(void) { int expectedResult = 0; int result = checkOperationInput(8); TEST_ASSERT_EQUAL_INT(expectedResult, result); +} + +void test_operationHandler_truereturnvaluewithformattedinput(void) { + int expectedResult = 1; + const char str[] = {'1', '4', ' ', '5', '6', '\0'}; + int result = containsTwoNumbers(str); + TEST_ASSERT_EQUAL_INT(expectedResult, result); +} + +void test_operationHandler_falsereturnvaluewithwronginput(void) { + int expectedResult = 0; + const char str[] = {'5', '6', '\0'}; + int result = containsTwoNumbers(str); + TEST_ASSERT_EQUAL_INT(expectedResult, result); +} + +void test_operationHandler_extractingFirstNumber(void) { + int expectedResult = 48; + char str[] = {'4', '8', ' ', '5', '\0'}; + int result = extractFirstNumber(str); + TEST_ASSERT_EQUAL_INT(expectedResult, result); } \ No newline at end of file