summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fifo-stack/fifo-stack-test.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/fifo-stack/fifo-stack-test.tex')
-rw-r--r--macros/latex/contrib/fifo-stack/fifo-stack-test.tex267
1 files changed, 267 insertions, 0 deletions
diff --git a/macros/latex/contrib/fifo-stack/fifo-stack-test.tex b/macros/latex/contrib/fifo-stack/fifo-stack-test.tex
new file mode 100644
index 0000000000..c8179eecd8
--- /dev/null
+++ b/macros/latex/contrib/fifo-stack/fifo-stack-test.tex
@@ -0,0 +1,267 @@
+%%
+%% This is file `fifo-stack-test.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% fifo-stack.dtx (with options: `qstest')
+%%
+%% Copyright (C) 2014 Stephen Gaito (PerceptiSys Ltd)
+%%
+%% This work may be distributed and/or modified under the conditions of the LaTeX
+%% Project Public License, either version 1.3 of this license or (at your
+%% option) any later version.
+%%
+%% The latest version of this license is in http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Stephen Gaito.
+%%
+%% The released source can be found at:
+%% https://github.com/diSimplex/latexFifoStack/tree/master/texStyle
+%%
+%% The development source can be found at:
+%% https://github.com/stephengaito/latexFifoStack/tree/master/texStyle
+%%
+%% This work consists of the files fifo-stack.dtx, and fifo-stack.ins.
+%%
+%% The command:
+%% pdflatex fifo-stack.ins
+%% followed by:
+%% pdflatex fifo-stack.dtx
+%% will produce the derived files: fifo-stack.sty, fifo-stack-test.tex,
+%% and fifo-stack.pdf.
+%%
+%% The command:
+%% pdflatex fifo-stack-test.tex
+%% will regression test the fifo-stack package. Output will be found in
+%% fifo-stack-test.lgout. If pdflatex completes with no errors, then all
+%% regression tests passed.
+%%
+\RequirePackage{qstest}
+\RequirePackage{xifthen}
+\IncludeTests{*}
+\LogTests{lgout}{*}{*}
+\RequirePackage{fifo-stack}
+\begin{qstest}{Simple stack integration test}
+ {\FSCreate, \FSPush, \FSPop, \FSTop}
+
+ \FSCreate{testStack}{defaultValue}
+ \Expect*{\FSTop{testStack}}{defaultValue}
+ \FSPush{testStack}{firstValue}
+ \Expect*{\FSTop{testStack}}{firstValue}
+ \FSPush{testStack}{secondValue}
+ \Expect*{\FSTop{testStack}}{secondValue}
+ \FSPush{testStack}{thirdValue}
+ \Expect*{\FSTop{testStack}}{thirdValue}
+ \FSPop{testStack}
+ \Expect*{\FSTop{testStack}}{secondValue}
+ \FSPop{testStack}
+ \Expect*{\FSTop{testStack}}{firstValue}
+ \FSPop{testStack}
+ \Expect*{\FSTop{testStack}}{defaultValue}
+ \FSPop{testStack}
+ \Expect*{\FSTop{testStack}}{defaultValue}
+\end{qstest}
+\begin{qstest}{Up down up down stack integration test}
+ {\FSCreate, \FSPush, \FSPop, \FSTop}
+
+ \FSCreate{testStackUDUD}{defaultValue}
+ \Expect*{\FSTop{testStackUDUD}}{defaultValue}
+ \FSPush{testStackUDUD}{firstValue}
+ \Expect*{\FSTop{testStackUDUD}}{firstValue}
+ \FSPush{testStackUDUD}{secondValue}
+ \Expect*{\FSTop{testStackUDUD}}{secondValue}
+ \FSPop{testStackUDUD}
+ \Expect*{\FSTop{testStackUDUD}}{firstValue}
+ \FSPush{testStackUDUD}{newSecondValue}
+ \Expect*{\FSTop{testStackUDUD}}{newSecondValue}
+\end{qstest}
+\begin{qstest}{Simple FIFO integration test}
+ {\FSCreate, \FSPush, \FSShift, \FSTop, \FSBottom}
+
+ \FSCreate{testFifo}{defaultValue}
+ \Expect*{\FSTop{testFifo}}{defaultValue}
+ \Expect*{\FSBottom{testFifo}}{defaultValue}
+ \FSPush{testFifo}{firstValue}
+ \Expect*{\FSTop{testFifo}}{firstValue}
+ \Expect*{\FSBottom{testFifo}}{firstValue}
+ \FSPush{testFifo}{secondValue}
+ \Expect*{\FSTop{testFifo}}{secondValue}
+ \Expect*{\FSBottom{testFifo}}{firstValue}
+ \FSShift{testFifo}
+ \Expect*{\FSTop{testFifo}}{secondValue}
+ \Expect*{\FSBottom{testFifo}}{secondValue}
+ \FSPush{testFifo}{thirdValue}
+ \Expect*{\FSTop{testFifo}}{thirdValue}
+ \Expect*{\FSBottom{testFifo}}{secondValue}
+ \FSShift{testFifo}
+ \Expect*{\FSTop{testFifo}}{thirdValue}
+ \Expect*{\FSBottom{testFifo}}{thirdValue}
+ \FSShift{testFifo}
+ \Expect*{\FSTop{testFifo}}{defaultValue}
+ \Expect*{\FSBottom{testFifo}}{defaultValue}
+ \FSShift{testFifo}
+ \Expect*{\FSTop{testFifo}}{defaultValue}
+ \Expect*{\FSBottom{testFifo}}{defaultValue}
+\end{qstest}
+\begin{qstest}{Simple linear use of unshift/shift}
+ {\FSUnshift, \FSShift}
+
+ \FSCreate{testRStack}{defaultValue}
+ \Expect*{\FSBottom{testRStack}}{defaultValue}
+ \FSUnshift{testRStack}{firstValue}
+ \Expect*{\FSBottom{testRStack}}{firstValue}
+ \FSUnshift{testRStack}{secondValue}
+ \Expect*{\FSBottom{testRStack}}{secondValue}
+ \FSUnshift{testRStack}{thirdValue}
+ \Expect*{\FSBottom{testRStack}}{thirdValue}
+ \FSShift{testRStack}
+ \Expect*{\FSBottom{testRStack}}{secondValue}
+ \FSShift{testRStack}
+ \Expect*{\FSBottom{testRStack}}{firstValue}
+ \FSShift{testRStack}
+ \Expect*{\FSBottom{testRStack}}{defaultValue}
+ \FSShift{testRStack}
+ \Expect*{\FSBottom{testRStack}}{defaultValue}
+\end{qstest}
+\begin{qstest}{Full non-linear FIFO/stack integration test}
+ {\FSCreate, \FSPush, \FSPop, \FSUnshift, \FSShift, \FSTop, \FSBottom}
+
+ \FSCreate{testFS}{defaultValue}
+ \Expect*{\FSTop{testFS}}{defaultValue}
+ \Expect*{\FSBottom{testFS}}{defaultValue}
+ \FSPush{testFS}{value1}
+ \Expect*{\FSTop{testFS}}{value1}
+ \Expect*{\FSBottom{testFS}}{value1}
+ \FSUnshift{testFS}{value-1}
+ \Expect*{\FSTop{testFS}}{value1}
+ \Expect*{\FSBottom{testFS}}{value-1}
+ \FSShift{testFS}
+ \Expect*{\FSTop{testFS}}{value1}
+ \Expect*{\FSBottom{testFS}}{value1}
+ \FSPush{testFS}{value2}
+ \Expect*{\FSTop{testFS}}{value2}
+ \Expect*{\FSBottom{testFS}}{value1}
+ \FSUnshift{testFS}{value-1again}
+ \Expect*{\FSTop{testFS}}{value2}
+ \Expect*{\FSBottom{testFS}}{value-1again}
+ \FSUnshift{testFS}{value-2}
+ \Expect*{\FSTop{testFS}}{value2}
+ \Expect*{\FSBottom{testFS}}{value-2}
+ \FSPop{testFS}
+ \Expect*{\FSTop{testFS}}{value1}
+ \Expect*{\FSBottom{testFS}}{value-2}
+ \FSPop{testFS}
+ \Expect*{\FSTop{testFS}}{value-1again}
+ \Expect*{\FSBottom{testFS}}{value-2}
+ \FSShift{testFS}
+ \Expect*{\FSTop{testFS}}{value-1again}
+ \Expect*{\FSBottom{testFS}}{value-1again}
+ \FSPop{testFS}
+ \Expect*{\FSTop{testFS}}{defaultValue}
+ \Expect*{\FSBottom{testFS}}{defaultValue}
+ \FSPop{testFS}
+ \Expect*{\FSTop{testFS}}{defaultValue}
+ \Expect*{\FSBottom{testFS}}{defaultValue}
+ \FSShift{testFS}
+ \Expect*{\FSTop{testFS}}{defaultValue}
+ \Expect*{\FSBottom{testFS}}{defaultValue}
+\end{qstest}
+\begin{qstest}{FSClear, FSSize, and FSDestroy test}
+ {\FSCreate, \FSPush, \FSPop, \FSUnshift, \FSShift, \FSTop,
+ \FSBottom, \FSClear, \FSDestroy, \FSSize}
+
+ \FSCreate{testFSC}{defaultValue}
+ \Expect*{\FSSize{testFSC}}{0}
+ \Expect*{\FSTop{testFSC}}{defaultValue}
+ \Expect*{\FSBottom{testFSC}}{defaultValue}
+ \FSPush{testFSC}{value1}
+ \Expect*{\FSSize{testFSC}}{1}
+ \Expect*{\FSTop{testFSC}}{value1}
+ \Expect*{\FSBottom{testFSC}}{value1}
+ \FSUnshift{testFSC}{value-1}
+ \Expect*{\FSSize{testFSC}}{2}
+ \Expect*{\FSTop{testFSC}}{value1}
+ \Expect*{\FSBottom{testFSC}}{value-1}
+ \FSPush{testFSC}{value2}
+ \Expect*{\FSSize{testFSC}}{3}
+ \Expect*{\FSTop{testFSC}}{value2}
+ \Expect*{\FSBottom{testFSC}}{value-1}
+ \FSUnshift{testFSC}{value-2}
+ \Expect*{\FSSize{testFSC}}{4}
+ \Expect*{\FSTop{testFSC}}{value2}
+ \Expect*{\FSBottom{testFSC}}{value-2}
+ \FSClear{testFSC}
+ \Expect*{\FSSize{testFSC}}{0}
+ \Expect*{\FSTop{testFSC}}{defaultValue}
+ \Expect*{\FSBottom{testFSC}}{defaultValue}
+ \FSPush{testFSC}{value1}
+ \Expect*{\FSSize{testFSC}}{1}
+ \Expect*{\FSTop{testFSC}}{value1}
+ \Expect*{\FSBottom{testFSC}}{value1}
+ \FSUnshift{testFSC}{value-1}
+ \Expect*{\FSSize{testFSC}}{2}
+ \Expect*{\FSTop{testFSC}}{value1}
+ \Expect*{\FSBottom{testFSC}}{value-1}
+ \FSPush{testFSC}{value2}
+ \Expect*{\FSSize{testFSC}}{3}
+ \Expect*{\FSTop{testFSC}}{value2}
+ \Expect*{\FSBottom{testFSC}}{value-1}
+ \FSUnshift{testFSC}{value-2}
+ \Expect*{\FSSize{testFSC}}{4}
+ \Expect*{\FSTop{testFSC}}{value2}
+ \Expect*{\FSBottom{testFSC}}{value-2}
+ \FSDestroy{testFSC}
+\end{qstest}
+\begin{qstest}{Unit test of \fifo@stack@pointer}{\fifo@stack@pointer}
+ \makeatletter
+ \Expect*{\fifo@stack@pointer{1}}{ii}
+ \Expect*{\fifo@stack@pointer{0}}{i}
+ \Expect*{\fifo@stack@pointer{-1}}{@i}
+ \makeatother
+\end{qstest}
+\begin{qstest}{Unit test of \FSdestroy}
+ {\FSCreate, \FSDestroy}
+
+ \FSCreate{testFSDestroy}{defaultValue}
+ \makeatletter
+ \ExpectIfThen{\isnamedefined{testFSDestroy@fifo@stack@count@top}}
+ \ExpectIfThen{\isnamedefined{testFSDestroy@fifo@stack@count@bottom}}
+ \ExpectIfThen{\isnamedefined{testFSDestroy@fifo@stack@count@size}}
+ \ExpectIfThen{\isnamedefined{fifo@stack@top@testFSDestroy}}
+ \ExpectIfThen{\isnamedefined{fifo@stack@bottom@testFSDestroy}}
+ \makeatother
+ \FSDestroy{testFSDestroy}
+ \makeatletter
+ \ExpectIfThen{\isundefined\testFSDestroy@fifo@stack@count@top}
+ \ExpectIfThen{\isundefined\testFSDestroy@fifo@stack@count@bottom}
+ \ExpectIfThen{\isundefined\testFSDestroy@fifo@stack@count@size}
+ \ExpectIfThen{\isundefined\fifo@stack@top@testFSDestroy}
+ \ExpectIfThen{\isundefined\fifo@stack@bottom@testFSDestroy}
+ \makeatother
+\end{qstest}
+\begin{qstest}{Unit test of \FSPush and \FSTop}
+ {\FSCreate, \FSPush, \FSTop}
+
+ \FSCreate{testFSPush}{defaultValue}
+ \Expect*{\FSTop{testFSPush}}{defaultValue}
+ \FSPush{testFSPush}{\FSTop{testFSPush}-with-additional-text}
+ \Expect*{\FSTop{testFSPush}}{defaultValue-with-additional-text}
+\end{qstest}
+\begin{qstest}{Unit test of \FSUnshift and \FSBottom}
+ {\FSCreate, \FSUnshift, \FSBottom}
+
+ \FSCreate{testFSUnshift}{defaultValue}
+ \Expect*{\FSBottom{testFSUnshift}}{defaultValue}
+ \FSUnshift{testFSUnshift}{\FSBottom{testFSUnshift}-with-additional-text}
+ \Expect*{\FSBottom{testFSUnshift}}{defaultValue-with-additional-text}
+\end{qstest}
+\LogClose{lgout}
+\stop
+\endinput
+%%
+%% End of file `fifo-stack-test.tex'.