diff options
author | Karl Berry <karl@freefriends.org> | 2007-10-05 23:13:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-10-05 23:13:42 +0000 |
commit | 4c911ff5ebf103e651707635abf2064ddf149c96 (patch) | |
tree | d3550a7008c8851c3df0746c7e9800df307a0699 /Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex | |
parent | f020fc73ad0b6e33f65d5f0b84646131e0340f2f (diff) |
oberdiek update/new: bigintcalc bitset grfext
git-svn-id: svn://tug.org/texlive/trunk@5118 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex | 166 |
1 files changed, 162 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex b/Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex index 696816c6f80..8242acd1ee7 100644 --- a/Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex +++ b/Master/texmf-dist/doc/latex/oberdiek/intcalc-test2.tex @@ -32,9 +32,9 @@ \nofiles \documentclass{article} \makeatletter -\chardef\IntCalc@TestMode=1 % +\chardef\InCa@TestMode=1 % \makeatother -\usepackage{intcalc}[2007/09/09] +\usepackage{intcalc}[2007/09/27] \usepackage{qstest} \IncludeTests{*} \LogTests{log}{*}{*} @@ -67,6 +67,9 @@ \newcommand*{\TestInv}[2]{% \Test{\intcalcInv{#1}}{#2}% } +\newcommand*{\TestNum}[2]{% + \Test{\intcalcNum{#1}}{#2}% +} \newcommand*{\TestAbs}[2]{% \Test{\intcalcAbs{#1}}{#2}% } @@ -84,24 +87,92 @@ } \newcommand*{\TestInc}[2]{% \Test{\intcalcInc{#1}}{#2}% + \ifnum\intcalcNum{#1}>-1 % + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcInc\intcalcNum{#1}!% + }{#2}% + }% + \x + \fi } \newcommand*{\TestDec}[2]{% \Test{\intcalcDec{#1}}{#2}% + \ifnum\intcalcNum{#1}>0 % + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcDec\intcalcNum{#1}!% + }{#2}% + }% + \x + \fi } \newcommand*{\TestAdd}[3]{% \Test{\intcalcAdd{#1}{#2}}{#3}% + \ifnum\intcalcNum{#1}>0 % + \ifnum\intcalcNum{#2}> 0 % + \ifnum\intcalcCmp{#1}{#2}>0 % + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcAdd + \intcalcNum{#1}!\intcalcNum{#2}!% + }{#3}% + }% + \x + \else + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcAdd + \intcalcNum{#2}!\intcalcNum{#1}!% + }{#3}% + }% + \x + \fi + \fi + \fi } \newcommand*{\TestSub}[3]{% \Test{\intcalcSub{#1}{#2}}{#3}% + \ifnum\intcalcNum{#1}>0 % + \ifnum\intcalcNum{#2}> 0 % + \ifnum\intcalcCmp{#1}{#2}>0 % + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcSub + \intcalcNum{#1}!\intcalcNum{#2}!% + }{#3}% + }% + \x + \fi + \fi + \fi } \newcommand*{\TestShl}[2]{% \Test{\intcalcShl{#1}}{#2}% + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcShl\intcalcAbs{#1}!% + }{\intcalcAbs{#2}}% + }% + \x } \newcommand*{\TestShr}[2]{% \Test{\intcalcShr{#1}}{#2}% + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcShr\intcalcAbs{#1}!% + }{\intcalcAbs{#2}}% + }% + \x } \newcommand*{\TestMul}[3]{% \Test{\intcalcMul{#1}{#2}}{#3}% + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcMul\intcalcAbs{#1}!\intcalcAbs{#2}!% + }{\intcalcAbs{#3}}% + }% + \x } \newcommand*{\TestSqr}[2]{% \Test{\intcalcSqr{#1}}{#2}% @@ -115,12 +186,93 @@ \newcommand*{\TestDiv}[3]{% \Test{\intcalcDiv{#1}{#2}}{#3}% \TestTeXDivide{#1}{#2}% + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcDiv\intcalcAbs{#1}!\intcalcAbs{#2}!% + }{\intcalcAbs{#3}}% + }% } \newcommand*{\TestMod}[3]{% \Test{\intcalcMod{#1}{#2}}{#3}% + \ifcase\ifcase\intcalcSgn{#1} 0% + \or + \ifcase\intcalcSgn{#2} 1% + \or 0% + \else 1% + \fi + \else + \ifcase\intcalcSgn{#2} 1% + \or 1% + \else 0% + \fi + \fi\relax + \edef\x{% + \noexpand\Test{% + \noexpand\IntCalcMod + \intcalcAbs{#1}!\intcalcAbs{#2}!% + }{\intcalcAbs{#3}}% + }% + \x + \fi } +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdfresettimer\endcsname\relax +\else + \makeatletter + \newcount\SummaryTime + \newcount\TestTime + \SummaryTime=\z@ + \newcommand*{\PrintTime}[2]{% + \typeout{% + [Time #1: \strip@pt\dimexpr\number#2sp\relax\space s]% + }% + }% + \newcommand*{\StartTime}[1]{% + \renewcommand*{\TimeDescription}{#1}% + \pdfresettimer + }% + \newcommand*{\TimeDescription}{}% + \newcommand*{\StopTime}{% + \TestTime=\pdfelapsedtime + \global\advance\SummaryTime\TestTime + \PrintTime\TimeDescription\TestTime + }% + \let\saved@qstest\qstest + \let\saved@endqstest\endqstest + \def\qstest#1#2{% + \saved@qstest{#1}{#2}% + \StartTime{#1}% + }% + \def\endqstest{% + \StopTime + \saved@endqstest + }% + \AtEndDocument{% + \PrintTime{summary}\SummaryTime + }% + \makeatother +\fi \makeatletter +\begin{qstest}{num}{num}% + \TestNum{0}{0}% + \TestNum{1}{1}% + \TestNum{-1}{-1}% + \TestNum{10}{10}% + \TestNum{-10}{-10}% + \TestNum{2147483647}{2147483647}% + \TestNum{-2147483647}{-2147483647}% + \TestNum{ 0 }{0}% + \TestNum{ 1 }{1}% + \TestNum{--1}{1}% + \TestNum{ - + - + 4 }{4}% + \TestNum{\z@}{0}% + \TestNum{\@ne}{1}% + \TestNum{\m@ne}{-1}% + \TestNum{-10+30}{20}% + \TestNum{10-30}{-20}% +\end{qstest} + \begin{qstest}{inv}{inv}% \TestInv{0}{0}% \TestInv{1}{-1}% @@ -324,6 +476,8 @@ \TestShl{1}{2}% \TestShl{5621}{11242}% \TestShl{1073741823}{2147483646}% + \TestShl{-1}{-2}% + \TestShl{-5621}{-11242}% \end{qstest} \begin{qstest}{shr}{shr} @@ -353,6 +507,10 @@ \TestShr{11241}{5620}% \TestShr{73054202}{36527101}% \TestShr{2147483646}{1073741823}% + \TestShr{-1}{0}% + \TestShr{-2}{-1}% + \TestShr{-3}{-1}% + \TestShr{-11241}{-5620}% \end{qstest} \begin{qstest}{mul}{mul} @@ -583,11 +741,11 @@ \TestError{FacNegative}{\intcalcFac{-2147483647}}% \TestError{FacOverflow}{\intcalcFac{13}}% \TestError{FacOverflow}{\intcalcFac{2147483647}}% - \TestError{ShlNegativeNumber}{\intcalcShl{-1}}% - \TestError{ShrNegativeNumber}{\intcalcShr{-1}}% \TestError{DivisionByZero}{\intcalcPow{0}{-1}}% \TestError{DivisionByZero}{\intcalcDiv{1}{0}}% \TestError{DivisionByZero}{\intcalcMod{1}{0}}% + \TestError{DivisionByZero}{\IntCalcDiv1!0!}% + \TestError{DivisionByZero}{\IntCalcMod1!0!}% \end{qstest} \begin{document} |