blob: 16b094dd50cd08ecc0a3e8dd57052ef433aa34ee (
plain) (
blame)
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
47
48
|
#include "vendor/unity.h"
#include "../src/two_fer.h"
#include <stddef.h>
#define BUFFER_SIZE (100)
void setUp(void)
{
}
void tearDown(void)
{
}
static void test_two_fer_no_name_given(void)
{
char response[BUFFER_SIZE];
const char *expected = "One for you, one for me.";
two_fer(response, NULL);
TEST_ASSERT_EQUAL_STRING(expected, response);
}
static void test_two_fer_a_name_given(void)
{
char response[BUFFER_SIZE];
const char *expected = "One for Alice, one for me.";
two_fer(response, "Alice");
TEST_ASSERT_EQUAL_STRING(expected, response);
}
static void test_two_fer_another_name_given(void)
{
char response[BUFFER_SIZE];
const char *expected = "One for Bob, one for me.";
two_fer(response, "Bob");
TEST_ASSERT_EQUAL_STRING(expected, response);
}
int main(void)
{
UnityBegin("test/test_two_fer.c");
RUN_TEST(test_two_fer_no_name_given);
RUN_TEST(test_two_fer_a_name_given);
RUN_TEST(test_two_fer_another_name_given);
return UnityEnd();
}
|