diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex | 166 |
1 files changed, 161 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex b/Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex index c01bff1c246..4874311d1f0 100644 --- a/Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex +++ b/Master/texmf-dist/doc/latex/oberdiek/intcalc-test3.tex @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% intcalc.dtx (with options: `test3,noetex') +%% intcalc.dtx (with options: `test2,noetex') %% %% This is a generated file. %% @@ -34,9 +34,9 @@ \let\SavedNumexpr\numexpr \let\numexpr\UNDEFINED \makeatletter -\chardef\IntCalc@TestMode=1 % +\chardef\InCa@TestMode=1 % \makeatother -\usepackage{intcalc}[2007/09/09] +\usepackage{intcalc}[2007/09/27] \let\numexpr\SavedNumexpr \usepackage{qstest} \IncludeTests{*} @@ -80,6 +80,9 @@ \newcommand*{\TestInv}[2]{% \Test{\intcalcInv{#1}}{#2}% } +\newcommand*{\TestNum}[2]{% + \Test{\intcalcNum{#1}}{#2}% +} \newcommand*{\TestAbs}[2]{% \Test{\intcalcAbs{#1}}{#2}% } @@ -97,24 +100,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}% @@ -128,12 +199,91 @@ \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}% +\end{qstest} + \begin{qstest}{inv}{inv}% \TestInv{0}{0}% \TestInv{1}{-1}% @@ -324,6 +474,8 @@ \TestShl{1}{2}% \TestShl{5621}{11242}% \TestShl{1073741823}{2147483646}% + \TestShl{-1}{-2}% + \TestShl{-5621}{-11242}% \end{qstest} \begin{qstest}{shr}{shr} @@ -353,6 +505,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} @@ -576,11 +732,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} |