Browse Source

Implement add detected Test for getNumber Function

remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
c05d58f22a
  1. 1
      project.yml
  2. 13
      test/test_inputHandling.c

1
project.yml

@ -47,6 +47,7 @@
:test: :test:
- *common_defines - *common_defines
- TEST - TEST
- UNITY_INCLUDE_DOUBLE
:test_preprocess: :test_preprocess:
- *common_defines - *common_defines
- TEST - TEST

13
test/test_inputHandling.c

@ -93,4 +93,17 @@ void test_inputHandling_getNumbersNoFormular(void)
pnt = getNumbers(halloWelt, 10, &formula); pnt = getNumbers(halloWelt, 10, &formula);
TEST_ASSERT_NULL(pnt); TEST_ASSERT_NULL(pnt);
} }
void test_inputHandling_getNumbersAddFormular(void)
{
char* pnt = NULL;
char add[] = "4+5";
formula.functionsType = detectFunctionOperator(add,3);
pnt = getNumbers(add, 3, &formula);
showStruct(&formula);
TEST_ASSERT_NULL(pnt);
TEST_ASSERT_EQUAL_DOUBLE(4.0, formula.inputNumbers[0]);
TEST_ASSERT_EQUAL_DOUBLE(5.0, formula.inputNumbers[1]);
TEST_ASSERT_EQUAL_INT(2, formula.arrayLength);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save