aboutsummaryrefslogtreecommitdiffstats
path: root/doc/usage.tex
blob: f8cde5deba128d24f5a583396b1a5117f518558b (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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
%%%%%%%%%%%
%  SETUP  %
%%%%%%%%%%%

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[usenames,x11names,table]{xcolor}

\usepackage{listings}
\usepackage{framed}

%%% -------------------------------------------------------
%%% universal formatting
%%% -------------------------------------------------------

\parindent 0pt
\frenchspacing
\pagestyle{empty}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\marginparsep}{0in}
\setlength{\marginparwidth}{0in}
\setlength{\textwidth}{6.5in}

\setlength{\topmargin}{0in}
\setlength{\headsep}{0in}
\setlength{\headheight}{0in}
\setlength{\textheight}{9in}

%%% -------------------------------------------------------
%%% custom commands
%%% -------------------------------------------------------

% a horizontal box with coloured background
\newcommand{\myheading}[1]{
	{
		\definecolor{shadecolor}{named}{Azure4}
		\begin{snugshade*}
			\centering\large
			\textcolor{white}{\textbf{-- #1 --}\vphantom{p\^{E}}}
		\end{snugshade*}
	}
}

\newcommand{\mytermrow}[2]{
	\tt\bf\small #1 & \tt\small #2 \\
}



\begin{document}
	
	% setup
	\frenchspacing
	
	% C styling
	\lstdefinestyle{customc}{
		language=C,
		basicstyle=\small\ttfamily,
		breaklines=true,
		keepspaces=true,
		xleftmargin=\parindent,
		% colours
		commentstyle=\color{DodgerBlue2},
		identifierstyle=\color{Red1},
		keywordstyle=\color{Purple3},
		stringstyle=\color{SpringGreen4},
		numbers=left,
		showstringspaces=false,
	}


	\myheading{usage}

	Your tests should be written as a single .c file separate from
	the body of text containing your functionality to be tested.
	A simple example might look something like this: \\ 

	\hrule
	\lstset{style=customc}
	\lstinputlisting{a_simple_example.c}
	\hrule
	\pagebreak

	If the second test was ommited, the ouput would look like this:\\

	\hrule
	\vspace{8pt}

	% successful output
	{\tt\bf\small a\_simple\_example.c}\\
	\begin{tabular*}{\textwidth}{r@{\ \tt\bf :: }l}
		\mytermrow{1}{\color{Yellow4}check add()'s return value}
		\mytermrow{ }{\color{SpringGreen4}success!}
	\end{tabular*}

	\vspace{8pt}
	\hrule
	\vspace{20pt}

	If the second test was included, it would look like this:\\

	\hrule
	\vspace{8pt}

	% failed output
	{\tt\bf\small a\_simple\_example.c}\\
	\begin{tabular*}{\textwidth}{r@{\ \tt\bf :: }l}
		\mytermrow{1}{\color{Yellow4}check add()'s return value}
		\mytermrow{2}{\color{Yellow4}compare two arrays of strings}
		\mytermrow{ }{\color{DodgerBlue2}checking strs at i == 0...}
		\mytermrow{ }{\color{DodgerBlue2}checking strs at i == 1...}
		\mytermrow{ }{\color{DodgerBlue2}checking strs at i == 2...}
		\mytermrow{ }{\textbf{a\_simple\_example.c:40: \textcolor{Red1}{fail:}} strings unequal}
		\mytermrow{ }{\ \ \textbf{array1[i]} == `str3'}
		\mytermrow{ }{\ \ \textbf{array2[i]} == `different'}
	\end{tabular*}
	
	\vspace{8pt}
	\hrule
	\vspace{20pt}

	For detailed descriptions of all available tests, see the included man page
	or README.md .

\end{document}