mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-23 11:09:28 -05:00
Folder structure change + Fix broken Projects (#103)
* Update folder structure * Correct project files * Move test folder * Some changes after Yuki's comments
This commit is contained in:
parent
98bfc38bf3
commit
a9b2aac4e9
62 changed files with 6804 additions and 7549 deletions
|
|
@ -0,0 +1,14 @@
|
|||
#include "hello_world.h"
|
||||
#include "some_value.h"
|
||||
|
||||
int8_t average(int8_t value1, int8_t value2, int8_t value3)
|
||||
{
|
||||
return (int8_t)( ( (int16_t)value1 + (int16_t)value2 + (int16_t)value3) / 3 );
|
||||
}
|
||||
|
||||
int Print_Hello_world( void )
|
||||
{
|
||||
int32_t value;
|
||||
value = some_number();
|
||||
return printf("Hello World! %d\n", value);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __HELLO_WORLD__
|
||||
#define __HELLO_WORLD__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
int8_t average(int8_t value1, int8_t value2, int8_t value3);
|
||||
int Print_Hello_world( void );
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/* 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);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#include "some_value.h"
|
||||
|
||||
int32_t some_number( void )
|
||||
{
|
||||
return ( int32_t ) 24;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef __SOME_VALUE__
|
||||
#define __SOME_VALUE__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t some_number( void );
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue