diff options
-rw-r--r-- | README.pdf | bin | 0 -> 144998 bytes | |||
-rw-r--r-- | README.tex | 174 |
2 files changed, 174 insertions, 0 deletions
diff --git a/README.pdf b/README.pdf Binary files differnew file mode 100644 index 0000000..8ff72c0 --- /dev/null +++ b/README.pdf diff --git a/README.tex b/README.tex new file mode 100644 index 0000000..d2ba778 --- /dev/null +++ b/README.tex @@ -0,0 +1,174 @@ +%%%%%%%%%%% +% SETUP % +%%%%%%%%%%% + +\documentclass[a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[usenames,x11names,table]{xcolor} + +\usepackage{listings} +\usepackage{enumitem} +\usepackage{graphicx} +\usepackage{framed} +\usepackage{calc} +\usepackage{ifthenx} +\usepackage{tabularx} +\usepackage{soul} + +%%% ------------------------------------------------------- +%%% 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{\myhl}[1]{ + { + \color{Snow1} + \sethlcolor{Red1} + \hl{#1} + } +} + +\newcommand{\myrow}[2]{ + \footnotesize\textcolor{DarkOrchid3}{\textbf{#1}}: & \small #2 \\[8pt] +} + + +\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, + } + + + \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{simple_test.c} + \hrule + \pagebreak + + If both tests above succeed, the output will look like this:\\ + + \hrule + \vspace{8pt} + + \begin{tabular*}{\textwidth}{r@{\ \tt\bf :: }l} + \tt\bf\small 1 & \tt\small\color{Brown3}description of the first test \\ + \tt\bf\small 2 & \tt\small\color{Brown3}this is the second test \\ + & \tt\small\color{SteelBlue3}grabbing heap string... \\ + \end{tabular*} + + \vspace{8pt} + \hrule + \vspace{20pt} + + If the first test fails, it will look something like this:\\ + \hrule + \vspace{8pt} + + \begin{tabular*}{\textwidth}{r@{\ \tt\bf :: }l} + \tt\bf\small 1 & \tt\small \color{Brown3}description of the first test \\ + \end{tabular*} + + \myhl{\tt\small\textbf{FAIL: error message shown on failing}} + + \begin{tabular*}{\textwidth}{r@{\ }l} + \tt\bf\small\color{Green3} expected: & \tt\small 6 \\ + \tt\bf\small\color{Red1} actual: & \tt\small 0 \\ + \end{tabular*} + + \vspace{8pt} + \hrule + + \pagebreak + + \myheading{defined macros} + \begin{tabularx}{\textwidth}{r@{\ }X} + \myrow{EXPECT\_ZERO(summary, arg)}{ + fail if \texttt{arg} does not resolve to 0 + } + \myrow{EXPECT\_ONE(summary, arg)}{ + fail if \texttt{arg} does not resolve to 1 + } + \myrow{EXPECT\_GREATER\_THAN\_ZERO(summary, arg)}{ + fail if \texttt{arg} does not resolve to a value + greater than 0. this will be replaced with more + generic integer comparisons soon. + } + \myrow{EXPECT\_INT(summary, arg1, arg2)}{ + fail if \texttt{arg2} does not match the + expected integer value \texttt{arg1} + } + \myrow{EXPECT\_EQUAL\_INT(summary, arg1, arg2)}{ + fail if \texttt{arg1} and \texttt{arg2} are + not equal + } + \myrow{EXPECT\_UNEQUAL\_INT(summary, arg1, arg2)}{ + fail if \texttt{arg1} and \texttt{arg2} are + equal + } + \myrow{EXPECT\_STR(summary, arg1, arg2)}{ + fail if string \texttt{arg2} does not match the + expected string value \texttt{arg1} + } + \myrow{EXPECT\_EQUAL\_STR(summary, arg1, arg2)}{ + fail if \texttt{arg1} and \texttt{arg2} are + not equivalent strings + } + \myrow{EXPECT\_UNEQUAL\_STR(summary, arg1, arg2)}{ + fail if \texttt{arg1} and \texttt{arg2} are + equivalent strings + } + \end{tabularx} + +\end{document} + |