You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.8 KiB
81 lines
1.8 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "inputHandling.h"
|
|
char halloWelt[]="Hallo Welt";
|
|
char halloWelt2[]="Hallo Welt";
|
|
char halloWelt3[]="Ha llo W el t ";
|
|
char halloWelt4[]="Ha\n\nllo \r W el\r\r t ";
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test_inputHandling_deleteOneWhiteSpace(void)
|
|
{
|
|
deleteWhitespace(halloWelt, 10);
|
|
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt);
|
|
}
|
|
|
|
void test_inputHandling_deleteTwoWhiteSpaces(void)
|
|
{
|
|
deleteWhitespace(halloWelt2, 11);
|
|
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt2);
|
|
}
|
|
|
|
void test_inputHandling_deleteManyWhiteSpaces(void)
|
|
{
|
|
deleteWhitespace(halloWelt3, 16);
|
|
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt3);
|
|
}
|
|
|
|
void test_inputHandling_deleteAllOtherCharacter(void)
|
|
{
|
|
deleteWhitespace(halloWelt4, 19);
|
|
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt4);
|
|
}
|
|
|
|
void test_inputHandling_findAddFunctionType(void)
|
|
{
|
|
op type = opNotSupported;
|
|
type = detectFunctionOperator("4+5", 3);
|
|
TEST_ASSERT_TRUE(opAdd == type);
|
|
}
|
|
|
|
void test_inputHandling_findSubFunctionType(void)
|
|
{
|
|
op type = opNotSupported;
|
|
type = detectFunctionOperator("4-5", 3);
|
|
TEST_ASSERT_TRUE(opSub == type);
|
|
}
|
|
|
|
void test_inputHandling_findMultiFunctionType(void)
|
|
{
|
|
op type = opNotSupported;
|
|
type = detectFunctionOperator("4*5", 3);
|
|
TEST_ASSERT_TRUE(opMult == type);
|
|
}
|
|
|
|
void test_inputHandling_findDivFunctionType(void)
|
|
{
|
|
op type = opNotSupported;
|
|
type = detectFunctionOperator("4/5", 3);
|
|
TEST_ASSERT_TRUE(opDiv == type);
|
|
type = opNotSupported;
|
|
type = detectFunctionOperator("4:5", 3);
|
|
TEST_ASSERT_TRUE(opDiv == type);
|
|
}
|
|
|
|
void test_inputHandling_findExpFunctionType(void)
|
|
{
|
|
op type = opNotSupported;
|
|
type = detectFunctionOperator("4^5", 3);
|
|
TEST_ASSERT_TRUE(opExp == type);
|
|
}
|
|
|
|
#endif // TEST
|