aboutsummaryrefslogtreecommitdiffstats
path: root/README.tex
diff options
context:
space:
mode:
authorshmibs <shmibs@gmail.com>2014-08-01 09:05:48 -0700
committershmibs <shmibs@gmail.com>2014-08-01 09:05:48 -0700
commit17c76a851e3c3550f6398aad11e7c71e1a122576 (patch)
tree9e15eb284966dec97032452b6cd3383da4fd6fb4 /README.tex
parent0cfbc56786d1e0141aaa89497515acaa89824665 (diff)
downloadsimple-test-17c76a851e3c3550f6398aad11e7c71e1a122576.tar.gz
all around cleanup
Diffstat (limited to 'README.tex')
-rw-r--r--README.tex76
1 files changed, 54 insertions, 22 deletions
diff --git a/README.tex b/README.tex
index 9a66a4b..6494ee5 100644
--- a/README.tex
+++ b/README.tex
@@ -58,10 +58,15 @@
}
}
-\newcommand{\myrow}[2]{
+\newcommand{\mymacrow}[2]{
\footnotesize\textcolor{DarkOrchid3}{\textbf{#1}}: & \small #2 \\[8pt]
}
+\newcommand{\mytermrow}[2]{
+ \tt\bf\small #1 & \tt\small #2 \\
+}
+
+
\begin{document}
@@ -93,7 +98,7 @@
\hrule
\lstset{style=customc}
- \lstinputlisting{simple_test.c}
+ \lstinputlisting{a_simple_example.c}
\hrule
\pagebreak
@@ -102,10 +107,12 @@
\hrule
\vspace{8pt}
+ % successful output
\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... \\
+ \mytermrow{1}{\color{Yellow4}description of the first test}
+ \mytermrow{2}{\color{Yellow4}this is the second test}
+ \mytermrow{ }{\color{DodgerBlue2}grabbing heap string...}
+ \mytermrow{ }{\color{SpringGreen4}success!}
\end{tabular*}
\vspace{8pt}
@@ -116,17 +123,14 @@
\hrule
\vspace{8pt}
+ % failed output
\begin{tabular*}{\textwidth}{r@{\ \tt\bf :: }l}
- \tt\bf\small 1 & \tt\small \color{Brown3}description of the first test \\
+ \mytermrow{1}{\color{Yellow4}description of the first test}
+ \mytermrow{ }{\color{Red1}FAIL: error message shown on failing}
+ \mytermrow{ }{\textcolor{SpringGreen4}{\textbf{\ \ expected:}}6}
+ \mytermrow{ }{\textcolor{Red1}{\textbf{\ \ \ \ actual:}}0}
\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
@@ -134,38 +138,66 @@
\myheading{defined macros}
\begin{tabularx}{\textwidth}{r@{\ }X}
- \myrow{EXPECT\_ZERO(summary, arg)}{
+ \mymacrow{BEGIN\_TEST}{
+ must appear before all tests and
+ after all global variable declarations
+ }
+ \mymacrow{END\_TEST}{
+ must appear at the end of your test
+ program
+ }
+ \mymacrow{CLEANUP(statements)}{
+ this defines a list of statements to run
+ when the test exits, either successfully or
+ on a failure. it isn't necessary for a test
+ to run, but, if it does appear, it must be
+ after the declaration of all variables to
+ which it makes reference.
+ }
+ \mymacrow{RETURN()}{
+ place at the end of a test which uses
+ CLEANUP to ensure it is called before the
+ test exits. i couldn't find any way around
+ this without using more than just one
+ header file, so i hope it isn't too annoying.
+ }
+ \mymacrow{STATE(description)}{
+ show a prettily-formatted description of the
+ program's state during a test. takes printf-style
+ arguments.
+ }
+ \mymacrow{EXPECT\_ZERO(summary, arg)}{
fail if \texttt{arg} does not resolve to 0
}
- \myrow{EXPECT\_ONE(summary, arg)}{
+ \mymacrow{EXPECT\_ONE(summary, arg)}{
fail if \texttt{arg} does not resolve to 1
}
- \myrow{EXPECT\_GREATER\_THAN\_ZERO(summary, arg)}{
+ \mymacrow{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)}{
+ \mymacrow{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)}{
+ \mymacrow{EXPECT\_EQUAL\_INT(summary, arg1, arg2)}{
fail if \texttt{arg1} and \texttt{arg2} are
not equal
}
- \myrow{EXPECT\_UNEQUAL\_INT(summary, arg1, arg2)}{
+ \mymacrow{EXPECT\_UNEQUAL\_INT(summary, arg1, arg2)}{
fail if \texttt{arg1} and \texttt{arg2} are
equal
}
- \myrow{EXPECT\_STR(summary, arg1, arg2)}{
+ \mymacrow{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)}{
+ \mymacrow{EXPECT\_EQUAL\_STR(summary, arg1, arg2)}{
fail if \texttt{arg1} and \texttt{arg2} are
not equivalent strings
}
- \myrow{EXPECT\_UNEQUAL\_STR(summary, arg1, arg2)}{
+ \mymacrow{EXPECT\_UNEQUAL\_STR(summary, arg1, arg2)}{
fail if \texttt{arg1} and \texttt{arg2} are
equivalent strings
}