File: strColor.c

package info (click to toggle)
swirc 3.5.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,044 kB
  • sloc: cpp: 18,690; ansic: 18,414; sh: 1,011; python: 254; makefile: 108; javascript: 20
file content (89 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "common.h"

#if defined(CURSES_HDR)
#include CURSES_HDR
#elif UNIX
#include <curses.h>
#elif WIN32
#include "pdcurses/curses.h"
#else
#error Cannot determine curses header file!
#endif

#include <setjmp.h>
#include <cmocka.h>

#include "strHand.h"

static void
returnsBlack(void **state)
{
	assert_string_equal(strColor(COLOR_BLACK), "Black");
	UNUSED_PARAM(state);
}

static void
returnsRed(void **state)
{
	assert_string_equal(strColor(COLOR_RED), "Red");
	UNUSED_PARAM(state);
}

static void
returnsGreen(void **state)
{
	assert_string_equal(strColor(COLOR_GREEN), "Green");
	UNUSED_PARAM(state);
}

static void
returnsYellow(void **state)
{
	assert_string_equal(strColor(COLOR_YELLOW), "Yellow");
	UNUSED_PARAM(state);
}

static void
returnsBlue(void **state)
{
	assert_string_equal(strColor(COLOR_BLUE), "Blue");
	UNUSED_PARAM(state);
}

static void
returnsMagenta(void **state)
{
	assert_string_equal(strColor(COLOR_MAGENTA), "Magenta");
	UNUSED_PARAM(state);
}

static void
returnsCyan(void **state)
{
	assert_string_equal(strColor(COLOR_CYAN), "Cyan");
	UNUSED_PARAM(state);
}

static void
returnsWhite(void **state)
{
	assert_string_equal(strColor(COLOR_WHITE), "White");
	UNUSED_PARAM(state);
}

int
main(void)
{
	const struct CMUnitTest tests[] = {
		cmocka_unit_test(returnsBlack),
		cmocka_unit_test(returnsRed),
		cmocka_unit_test(returnsGreen),
		cmocka_unit_test(returnsYellow),
		cmocka_unit_test(returnsBlue),
		cmocka_unit_test(returnsMagenta),
		cmocka_unit_test(returnsCyan),
		cmocka_unit_test(returnsWhite),
	};

	return cmocka_run_group_tests(tests, NULL, NULL);
}