Browse Source

Added multiple tests for operation handler input processing

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
57f159cd96
  1. 21
      test/test_operationHandler.c

21
test/test_operationHandler.c

@ -25,4 +25,25 @@ void test_operationHandler_falsereturnvaluewithinvalidinput(void) {
int expectedResult = 0; int expectedResult = 0;
int result = checkOperationInput(8); int result = checkOperationInput(8);
TEST_ASSERT_EQUAL_INT(expectedResult, result); 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);
} }
Loading…
Cancel
Save