blob: c916c051deccf971ffd00346897edbad0bae3625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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);
}
|