%%%%%%%%%%% % 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}