FreeRTOS-Kernel/FreeRTOS-Plus/Test/Unit-Tests/tests/example/hello_world_test.c
Aniruddha Kanhere 95a3a02f95
FreeRTOS-Plus: Unit testing Infrastructure and examples (#72)
* Added CMock as submodule

* Makefile added

* Removed TEMP from Makefile

* Added configuration files and header files

* Update Makefile

* Test runner working

* make clean

* Example added with README

* Update README.md

* Restored +TCP files

* Cleared +TCP changes

* removed comments from Makefile

* Update README.md

* Update README.md

* Update README.md

* Updated Test/Unit-test/readme.md
2020-05-22 16:26:59 -07:00

46 lines
975 B
C

/* Include Unity header */
#include <unity.h>
/* Include standard libraries */
#include <stdlib.h>
#include <string.h>
#include "mock_some_value.h"
/* Include header file(s) which have declaration
* of functions under test */
#include "hello_world.h"
void test_average_normal( void )
{
int8_t result;
/* Check normal operation */
result = average(4, 5, 6);
TEST_ASSERT_EQUAL_INT(5, result);
/* Check whether the buffer used to store
* intermediate result overflows or not */
result = average(255, 255, 255);
TEST_ASSERT_EQUAL_INT(-1, result);
}
void test_average_round_off( void )
{
int8_t result;
/* Check the round off value */
result = average(1, 2, 2);
TEST_ASSERT_EQUAL_INT(1, result);
}
void test_Print_Hello_world( void )
{
int32_t result;
/* check how the Printf returns the value */
some_number_ExpectAndReturn( 5 );
result = Print_Hello_world();
TEST_ASSERT_EQUAL_INT(15, result);
}