%%
%% This is file `bigintcalc-test2.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bigintcalc.dtx  (with options: `test2,etex')
%% 
%% This is a generated file.
%% 
%% Project: bigintcalc
%% Version: 2012/04/08 v1.3
%% 
%% Copyright (C) 2007, 2011, 2012 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and 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".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file bigintcalc.dtx
%% and the derived files
%%    bigintcalc.sty, bigintcalc.pdf, bigintcalc.ins, bigintcalc.drv,
%%    bigintcalc-test1.tex, bigintcalc-test2.tex,
%%    bigintcalc-test3.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\nofiles
\documentclass{article}
\makeatletter
\chardef\BIC@TestMode=1 %
\makeatother
\usepackage{bigintcalc}[2012/04/08]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
\newcommand*{\TestSpaceAtEnd}[1]{%
  \edef\resultA{#1}%
  \edef\resultB{#1 }%
  \Expect*{\resultA\space}*{\resultB}%
}
\newcommand*{\TestResult}[2]{%
  \edef\result{#1}%
  \Expect*{\result}{#2}%
}
\newcommand*{\TestResultTwoExpansions}[2]{%
  \expandafter\expandafter\expandafter\Expect
  \expandafter\expandafter\expandafter{#1}{#2}%
}
\newcount\TestCount
\newcommand*{\TestArg}[1]{\numexpr#1\relax}
\newcommand*{\TestTeXDivide}[2]{%
  \TestCount=\TestArg{#1}\relax
  \divide\TestCount by \TestArg{#2}\relax
  \Expect*{\bigintcalcDiv{#1}{#2}}*{\the\TestCount}%
}
\newcommand*{\Test}[2]{%
  \TestResult{#1}{#2}%
  \TestResultTwoExpansions{#1}{#2}%
  \TestSpaceAtEnd{#1}%
}
\newcommand*{\TestExch}[2]{\Test{#2}{#1}}
\newcommand*{\TestInv}[2]{%
  \Test{\bigintcalcInv{#1}}{#2}%
}
\newcommand*{\TestAbs}[2]{%
  \Test{\bigintcalcAbs{#1}}{#2}%
}
\newcommand*{\TestSgn}[2]{%
  \Test{\bigintcalcSgn{#1}}{#2}%
}
\newcommand*{\TestMin}[3]{%
  \Test{\bigintcalcMin{#1}{#2}}{#3}%
}
\newcommand*{\TestMax}[3]{%
  \Test{\bigintcalcMax{#1}{#2}}{#3}%
}
\newcommand*{\TestCmp}[3]{%
  \Test{\bigintcalcCmp{#1}{#2}}{#3}%
}
\newcommand*{\TestOdd}[2]{%
  \Test{\bigintcalcOdd{#1}}{#2}%
  \edef\x{%
    \noexpand\Test{%
      \noexpand\BigIntCalcOdd
      \bigintcalcAbs{#1}!%
    }{#2}%
  }%
  \x
}
\newcommand*{\TestInc}[2]{%
  \Test{\bigintcalcInc{#1}}{#2}%
  \ifnum\bigintcalcSgn{#1}>-1 %
    \edef\x{%
      \noexpand\Test{%
        \noexpand\BigIntCalcInc\bigintcalcNum{#1}!%
      }{#2}%
    }%
    \x
  \fi
}
\newcommand*{\TestDec}[2]{%
  \Test{\bigintcalcDec{#1}}{#2}%
  \ifnum\bigintcalcSgn{#1}>0 %
    \edef\x{%
      \noexpand\Test{%
        \noexpand\BigIntCalcDec\bigintcalcNum{#1}!%
      }{#2}%
    }%
    \x
  \fi
}
\newcommand*{\TestAdd}[3]{%
  \Test{\bigintcalcAdd{#1}{#2}}{#3}%
  \ifnum\bigintcalcSgn{#1}>0 %
    \ifnum\bigintcalcSgn{#2}> 0 %
      \ifnum\bigintcalcCmp{#1}{#2}>0 %
        \edef\x{%
          \noexpand\Test{%
            \noexpand\BigIntCalcAdd
            \bigintcalcNum{#1}!\bigintcalcNum{#2}!%
          }{#3}%
        }%
        \x
      \else
        \edef\x{%
          \noexpand\Test{%
            \noexpand\BigIntCalcAdd
            \bigintcalcNum{#2}!\bigintcalcNum{#1}!%
          }{#3}%
        }%
        \x
      \fi
    \fi
  \fi
}
\newcommand*{\TestSub}[3]{%
  \Test{\bigintcalcSub{#1}{#2}}{#3}%
  \ifnum\bigintcalcSgn{#1}>0 %
    \ifnum\bigintcalcSgn{#2}> 0 %
      \ifnum\bigintcalcCmp{#1}{#2}>0 %
        \edef\x{%
          \noexpand\Test{%
            \noexpand\BigIntCalcSub
            \bigintcalcNum{#1}!\bigintcalcNum{#2}!%
          }{#3}%
        }%
        \x
      \fi
    \fi
  \fi
}
\newcommand*{\TestShl}[2]{%
  \Test{\bigintcalcShl{#1}}{#2}%
  \edef\x{%
    \noexpand\Test{%
      \noexpand\BigIntCalcShl\bigintcalcAbs{#1}!%
    }{\bigintcalcAbs{#2}}%
  }%
  \x
}
\newcommand*{\TestShr}[2]{%
  \Test{\bigintcalcShr{#1}}{#2}%
  \edef\x{%
    \noexpand\Test{%
      \noexpand\BigIntCalcShr\bigintcalcAbs{#1}!%
    }{\bigintcalcAbs{#2}}%
  }%
  \x
}
\newcommand*{\TestMul}[3]{%
  \Test{\bigintcalcMul{#1}{#2}}{#3}%
  \edef\x{%
    \noexpand\Test{%
      \noexpand\BigIntCalcMul
      \bigintcalcAbs{#1}!\bigintcalcAbs{#2}!%
    }{\bigintcalcAbs{#3}}%
  }%
  \x
}
\newcommand*{\TestSqr}[2]{%
  \Test{\bigintcalcSqr{#1}}{#2}%
}
\newcommand*{\TestFac}[2]{%
  \expandafter\TestExch\expandafter{%
    \the\numexpr#2%
  }{\bigintcalcFac{#1}}%
}
\newcommand*{\TestFacBig}[2]{%
  \Test{\bigintcalcFac{#1}}{#2}%
}
\newcommand*{\TestPow}[3]{%
  \Test{\bigintcalcPow{#1}{#2}}{#3}%
}
\newcommand*{\TestDiv}[3]{%
  \Test{\bigintcalcDiv{#1}{#2}}{#3}%
  \TestTeXDivide{#1}{#2}%
}
\newcommand*{\TestDivBig}[3]{%
  \Test{\bigintcalcDiv{#1}{#2}}{#3}%
  \edef\x{%
    \noexpand\Test{%
      \noexpand\BigIntCalcDiv\bigintcalcAbs{#1}!\bigintcalcAbs{#2}!%
    }{\bigintcalcAbs{#3}}%
  }%
}
\newcommand*{\TestMod}[3]{%
  \Test{\bigintcalcMod{#1}{#2}}{#3}%
  \ifcase\ifcase\bigintcalcSgn{#1} 0%
         \or
           \ifcase\bigintcalcSgn{#2} 1%
           \or 0%
           \else 1%
           \fi
         \else
           \ifcase\bigintcalcSgn{#2} 1%
           \or 1%
           \else 0%
           \fi
         \fi\relax
    \edef\x{%
      \noexpand\Test{%
        \noexpand\BigIntCalcMod
        \bigintcalcAbs{#1}!\bigintcalcAbs{#2}!%
      }{\bigintcalcAbs{#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}{inv}{inv}%
  \TestInv{0}{0}%
  \TestInv{1}{-1}%
  \TestInv{-1}{1}%
  \TestInv{10}{-10}%
  \TestInv{-10}{10}%
  \TestInv{2147483647}{-2147483647}%
  \TestInv{-2147483647}{2147483647}%
  \TestInv{12345678901234567890}{-12345678901234567890}%
  \TestInv{-12345678901234567890}{12345678901234567890}%
  \TestInv{ 0 }{0}%
  \TestInv{ 1 }{-1}%
  \TestInv{--1}{-1}%
  \TestInv{\number\z@}{0}%
  \TestInv{\ifx\relax\relax1\fi}{-1}%
  \TestInv{\ifx\relax\relax-\fi\ifx234\else1\fi}{1}%
\end{qstest}

\begin{qstest}{abs}{abs}%
  \TestAbs{0}{0}%
  \TestAbs{1}{1}%
  \TestAbs{-1}{1}%
  \TestAbs{10}{10}%
  \TestAbs{-10}{10}%
  \TestAbs{2147483647}{2147483647}%
  \TestAbs{-2147483647}{2147483647}%
  \TestAbs{12345678901234567890}{12345678901234567890}%
  \TestAbs{-12345678901234567890}{12345678901234567890}%
  \TestAbs{ 0 }{0}%
  \TestAbs{ 1 }{1}%
  \TestAbs{--1}{1}%
  \TestAbs{-+-+1}{1}%
  \TestAbs{00000000000}{0}%
  \TestAbs{00000001000}{1000}%
  \TestAbs{\ifx\relax\relax 0\else 1\fi}{0}%
\end{qstest}

\begin{qstest}{sign}{sign}%
  \TestSgn{0}{0}%
  \TestSgn{1}{1}%
  \TestSgn{-1}{-1}%
  \TestSgn{10}{1}%
  \TestSgn{-10}{-1}%
  \TestSgn{2147483647}{1}%
  \TestSgn{-2147483647}{-1}%
  \TestSgn{12345678901234567890}{1}%
  \TestSgn{-12345678901234567890}{-1}%
  \TestSgn{ 0 }{0}%
  \TestSgn{ 2 }{1}%
  \TestSgn{ -2 }{-1}%
  \TestSgn{--2}{1}%
  \TestSgn{\number\z@}{0}%
  \TestSgn{\number\@ne}{1}%
  \TestSgn{\number\m@ne}{-1}%
  \TestSgn{%
    -+-+\number\z@\number\z@
    \iftrue1\fi\iftrue2\fi\iftrue3\fi
  }{1}%
\end{qstest}

\begin{qstest}{min}{min}%
  \TestMin{0}{1}{0}%
  \TestMin{1}{0}{0}%
  \TestMin{-10}{-20}{-20}%
  \TestMin{ 1 }{ 2 }{1}%
  \TestMin{ 2 }{ 1 }{1}%
  \TestMin{1}{1}{1}%
  \TestMin{\number\z@}{\number\@ne}{0}%
  \TestMin{\number\@ne}{\number\m@ne}{-1}%
\end{qstest}

\begin{qstest}{max}{max}%
  \TestMax{0}{1}{1}%
  \TestMax{1}{0}{1}%
  \TestMax{-10}{-20}{-10}%
  \TestMax{ 1 }{ 2 }{2}%
  \TestMax{ 2 }{ 1 }{2}%
  \TestMax{1}{1}{1}%
  \TestMax{\number\z@}{\number\@ne}{1}%
  \TestMax{\number\@ne}{\number\m@ne}{1}%
\end{qstest}

\begin{qstest}{cmp}{cmp}%
  \TestCmp{0}{0}{0}%
  \TestCmp{-21}{17}{-1}%
  \TestCmp{3}{4}{-1}%
  \TestCmp{-10}{-10}{0}%
  \TestCmp{-10}{-11}{1}%
  \TestCmp{100}{5}{1}%
  \TestCmp{9}{10}{-1}%
  \TestCmp{10}{9}{1}%
  \TestCmp{ 3 }{ 3 }{0}%
  \TestCmp{-9}{-10}{1}%
  \TestCmp{-10}{-9}{-1}%
  \TestCmp{-3}{-3}{0}%
  \TestCmp{0}{-2}{1}%
  \TestCmp{0}{2}{-1}%
  \TestCmp{2}{0}{1}%
  \TestCmp{-2}{0}{-1}%
  \TestCmp{12}{11}{1}%
  \TestCmp{11}{12}{-1}%
  \TestCmp{2147483647}{-2147483647}{1}%
  \TestCmp{-2147483647}{2147483647}{-1}%
  \TestCmp{2147483647}{2147483647}{0}%
  \TestCmp{\number\z@}{\number\@ne}{-1}%
  \TestCmp{\number\@ne}{\number\m@ne}{1}%
  \TestCmp{ 4 }{ 5 }{-1}%
  \TestCmp{ -3 }{ -7 }{1}%
\end{qstest}

\begin{qstest}{odd}{odd}
\tracingmacros=1
  \TestOdd{0}{0}%
  \TestOdd{1}{1}%
  \TestOdd{2}{0}%
  \TestOdd{3}{1}%
  \TestOdd{14}{0}%
  \TestOdd{15}{1}%
  \TestOdd{12345678901234567896}{0}%
  \TestOdd{12345678901234567897}{1}%
\end{qstest}

\begin{qstest}{inc}{inc}%
  \TestInc{0}{1}%
  \TestInc{1}{2}%
  \TestInc{-1}{0}%
  \TestInc{10}{11}%
  \TestInc{-10}{-9}%
  \TestInc{ 3 }{4}%
  \TestInc{999}{1000}%
  \TestInc{-1000}{-999}%
  \TestInc{129}{130}%
  \TestInc{2147483646}{2147483647}%
  \TestInc{-2147483647}{-2147483646}%
  \TestInc{12345678901234567890}{12345678901234567891}%
  \TestInc{99999999999999999999}{100000000000000000000}%
  \TestInc{-12345678901234567891}{-12345678901234567890}%
  \TestInc{-100000000000000000000}{-99999999999999999999}%
\end{qstest}

\begin{qstest}{dec}{dec}%
  \TestDec{0}{-1}%
  \TestDec{1}{0}%
  \TestDec{-1}{-2}%
  \TestDec{10}{9}%
  \TestDec{-10}{-11}%
  \TestDec{1000}{999}%
  \TestDec{-999}{-1000}%
  \TestDec{130}{129}%
  \TestDec{2147483647}{2147483646}%
  \TestDec{-2147483646}{-2147483647}%
  \TestDec{12345678901234567891}{12345678901234567890}%
  \TestDec{100000000000000000000}{99999999999999999999}%
  \TestDec{-12345678901234567890}{-12345678901234567891}%
  \TestDec{-99999999999999999999}{-100000000000000000000}%
\end{qstest}

\begin{qstest}{add}{add}%
  \TestAdd{0}{0}{0}%
  \TestAdd{1}{0}{1}%
  \TestAdd{0}{1}{1}%
  \TestAdd{1}{2}{3}%
  \TestAdd{-1}{-1}{-2}%
  \TestAdd{2147483646}{1}{2147483647}%
  \TestAdd{-2147483647}{2147483647}{0}%
  \TestAdd{20}{-5}{15}%
  \TestAdd{-4}{-1}{-5}%
  \TestAdd{-1}{-4}{-5}%
  \TestAdd{-4}{1}{-3}%
  \TestAdd{-1}{4}{3}%
  \TestAdd{4}{-1}{3}%
  \TestAdd{1}{-4}{-3}%
  \TestAdd{-4}{-1}{-5}%
  \TestAdd{-1}{-4}{-5}%
  \TestAdd{ -4 }{ -1 }{-5}%
  \TestAdd{ -1 }{ -4 }{-5}%
  \TestAdd{ -4 }{ 1 }{-3}%
  \TestAdd{ -1 }{ 4 }{3}%
  \TestAdd{ 4 }{ -1 }{3}%
  \TestAdd{ 1 }{ -4 }{-3}%
  \TestAdd{ -4 }{ -1 }{-5}%
  \TestAdd{ -1 }{ -4 }{-5}%
  \TestAdd{876543210}{111111111}{987654321}%
  \TestAdd{999999999}{2}{1000000001}%
\end{qstest}

\begin{qstest}{sub}{sub}
  \TestSub{0}{0}{0}%
  \TestSub{1}{0}{1}%
  \TestSub{1}{2}{-1}%
  \TestSub{-1}{-1}{0}%
  \TestSub{2147483646}{-1}{2147483647}%
  \TestSub{-2147483647}{-2147483647}{0}%
  \TestSub{-4}{-1}{-3}%
  \TestSub{-1}{-4}{3}%
  \TestSub{-4}{1}{-5}%
  \TestSub{-1}{4}{-5}%
  \TestSub{4}{-1}{5}%
  \TestSub{1}{-4}{5}%
  \TestSub{-4}{-1}{-3}%
  \TestSub{-1}{-4}{3}%
  \TestSub{ -4 }{ -1 }{-3}%
  \TestSub{ -1 }{ -4 }{3}%
  \TestSub{ -4 }{ 1 }{-5}%
  \TestSub{ -1 }{ 4 }{-5}%
  \TestSub{ 4 }{ -1 }{5}%
  \TestSub{ 1 }{ -4 }{5}%
  \TestSub{ -4 }{ -1 }{-3}%
  \TestSub{ -1 }{ -4 }{3}%
  \TestSub{1000000000}{2}{999999998}%
  \TestSub{987654321}{111111111}{876543210}%
\end{qstest}

\begin{qstest}{shl}{shl}
  \TestShl{0}{0}%
  \TestShl{1}{2}%
  \TestShl{2}{4}%
  \TestShl{5621}{11242}%
  \TestShl{1073741823}{2147483646}%
\end{qstest}

\begin{qstest}{shr}{shr}
  \TestShr{0}{0}%
  \TestShr{1}{0}%
  \TestShr{2}{1}%
  \TestShr{3}{1}%
  \TestShr{4}{2}%
  \TestShr{5}{2}%
  \TestShr{6}{3}%
  \TestShr{7}{3}%
  \TestShr{8}{4}%
  \TestShr{9}{4}%
  \TestShr{10}{5}%
  \TestShr{11}{5}%
  \TestShr{12}{6}%
  \TestShr{13}{6}%
  \TestShr{14}{7}%
  \TestShr{15}{7}%
  \TestShr{16}{8}%
  \TestShr{17}{8}%
  \TestShr{18}{9}%
  \TestShr{19}{9}%
  \TestShr{20}{10}%
  \TestShr{21}{10}%
  \TestShr{22}{11}%
  \TestShr{11241}{5620}%
  \TestShr{73054202}{36527101}%
  \TestShr{2147483646}{1073741823}%
\end{qstest}

\begin{qstest}{mul}{mul}
  \TestMul{0}{0}{0}%
  \TestMul{1}{0}{0}%
  \TestMul{0}{1}{0}%
  \TestMul{1}{1}{1}%
  \TestMul{3}{1}{3}%
  \TestMul{1}{-3}{-3}%
  \TestMul{-4}{-5}{20}%
  \TestMul{3}{7}{21}%
  \TestMul{7}{3}{21}%
  \TestMul{3}{-7}{-21}%
  \TestMul{7}{-3}{-21}%
  \TestMul{-3}{7}{-21}%
  \TestMul{-7}{3}{-21}%
  \TestMul{-3}{-7}{21}%
  \TestMul{-7}{-3}{21}%
  \TestMul{12}{11}{132}%
  \TestMul{999}{333}{332667}%
  \TestMul{1000}{4321}{4321000}%
  \TestMul{12345}{173955}{2147474475}%
  \TestMul{1073741823}{2}{2147483646}%
  \TestMul{2}{1073741823}{2147483646}%
  \TestMul{-1073741823}{2}{-2147483646}%
  \TestMul{2}{-1073741823}{-2147483646}%
  \TestMul{6706022400}{13}{87178291200}%
\end{qstest}

\begin{qstest}{sqr}{sqr}
  \TestSqr{0}{0}%
  \TestSqr{1}{1}%
  \TestSqr{2}{4}%
  \TestSqr{3}{9}%
  \TestSqr{4}{16}%
  \TestSqr{9}{81}%
  \TestSqr{10}{100}%
  \TestSqr{46340}{2147395600}%
  \TestSqr{-1}{1}%
  \TestSqr{-2}{4}%
  \TestSqr{-46340}{2147395600}%
\end{qstest}

\begin{qstest}{fac}{fac}
  \TestFac{0}{1}%
  \TestFac{1}{1}%
  \TestFac{2}{2}%
  \TestFac{3}{2*3}%
  \TestFac{4}{2*3*4}%
  \TestFac{5}{2*3*4*5}%
  \TestFac{6}{2*3*4*5*6}%
  \TestFac{7}{2*3*4*5*6*7}%
  \TestFac{8}{2*3*4*5*6*7*8}%
  \TestFac{9}{2*3*4*5*6*7*8*9}%
  \TestFac{10}{2*3*4*5*6*7*8*9*10}%
  \TestFac{11}{2*3*4*5*6*7*8*9*10*11}%
  \TestFac{12}{2*3*4*5*6*7*8*9*10*11*12}%
  \TestFacBig{13}{6227020800}%
  \TestFacBig{14}{87178291200}%
  \TestFacBig{15}{1307674368000}%
  \TestFacBig{16}{20922789888000}%
  \TestFacBig{17}{355687428096000}%
  \TestFacBig{18}{6402373705728000}%
  \TestFacBig{19}{121645100408832000}%
  \TestFacBig{20}{2432902008176640000}%
  \TestFacBig{21}{51090942171709440000}%
  \TestFacBig{22}{1124000727777607680000}%
\end{qstest}

\begin{qstest}{pow}{pow}
  \TestPow{-2}{0}{1}%
  \TestPow{-1}{0}{1}%
  \TestPow{0}{0}{1}%
  \TestPow{1}{0}{1}%
  \TestPow{2}{0}{1}%
  \TestPow{3}{0}{1}%
  \TestPow{-2}{1}{-2}%
  \TestPow{-1}{1}{-1}%
  \TestPow{1}{1}{1}%
  \TestPow{2}{1}{2}%
  \TestPow{3}{1}{3}%
  \TestPow{-2}{2}{4}%
  \TestPow{-1}{2}{1}%
  \TestPow{0}{2}{0}%
  \TestPow{1}{2}{1}%
  \TestPow{2}{2}{4}%
  \TestPow{3}{2}{9}%
  \TestPow{0}{1}{0}%
  \TestPow{1}{-2}{1}%
  \TestPow{1}{-1}{1}%
  \TestPow{-1}{-2}{1}%
  \TestPow{-1}{-1}{-1}%
  \TestPow{-1}{3}{-1}%
  \TestPow{-1}{4}{1}%
  \TestPow{-2}{-1}{0}%
  \TestPow{-2}{-2}{0}%
  \TestPow{2}{3}{8}%
  \TestPow{2}{4}{16}%
  \TestPow{2}{5}{32}%
  \TestPow{2}{6}{64}%
  \TestPow{2}{7}{128}%
  \TestPow{2}{8}{256}%
  \TestPow{2}{9}{512}%
  \TestPow{2}{10}{1024}%
  \TestPow{-2}{3}{-8}%
  \TestPow{-2}{4}{16}%
  \TestPow{-2}{5}{-32}%
  \TestPow{-2}{6}{64}%
  \TestPow{-2}{7}{-128}%
  \TestPow{-2}{8}{256}%
  \TestPow{-2}{9}{-512}%
  \TestPow{-2}{10}{1024}%
  \TestPow{3}{3}{27}%
  \TestPow{3}{4}{81}%
  \TestPow{3}{5}{243}%
  \TestPow{-3}{3}{-27}%
  \TestPow{-3}{4}{81}%
  \TestPow{-3}{5}{-243}%
  \TestPow{2}{30}{1073741824}%
  \TestPow{-3}{19}{-1162261467}%
  \TestPow{5}{13}{1220703125}%
  \TestPow{-7}{11}{-1977326743}%
\end{qstest}

\begin{qstest}{div}{div}
  \TestDiv{1}{1}{1}%
  \TestDiv{2}{1}{2}%
  \TestDiv{-2}{1}{-2}%
  \TestDiv{2}{-1}{-2}%
  \TestDiv{-2}{-1}{2}%
  \TestDiv{15}{2}{7}%
  \TestDiv{-16}{2}{-8}%
  \TestDiv{1}{2}{0}%
  \TestDiv{1}{3}{0}%
  \TestDiv{2}{3}{0}%
  \TestDiv{-2}{3}{0}%
  \TestDiv{2}{-3}{0}%
  \TestDiv{-2}{-3}{0}%
  \TestDiv{13}{3}{4}%
  \TestDiv{-13}{-3}{4}%
  \TestDiv{-13}{3}{-4}%
  \TestDiv{-6}{5}{-1}%
  \TestDiv{-5}{5}{-1}%
  \TestDiv{-4}{5}{0}%
  \TestDiv{-3}{5}{0}%
  \TestDiv{-2}{5}{0}%
  \TestDiv{-1}{5}{0}%
  \TestDiv{0}{5}{0}%
  \TestDiv{1}{5}{0}%
  \TestDiv{2}{5}{0}%
  \TestDiv{3}{5}{0}%
  \TestDiv{4}{5}{0}%
  \TestDiv{5}{5}{1}%
  \TestDiv{6}{5}{1}%
  \TestDiv{-5}{4}{-1}%
  \TestDiv{-4}{4}{-1}%
  \TestDiv{-3}{4}{0}%
  \TestDiv{-2}{4}{0}%
  \TestDiv{-1}{4}{0}%
  \TestDiv{0}{4}{0}%
  \TestDiv{1}{4}{0}%
  \TestDiv{2}{4}{0}%
  \TestDiv{3}{4}{0}%
  \TestDiv{4}{4}{1}%
  \TestDiv{5}{4}{1}%
  \TestDiv{12345}{678}{18}%
  \TestDiv{32372}{5952}{5}%
  \TestDiv{284271294}{18162}{15651}%
  \TestDiv{217652429}{12561}{17327}%
  \TestDiv{462028434}{5439}{84947}%
  \TestDiv{2147483647}{1000}{2147483}%
  \TestDiv{2147483647}{-1000}{-2147483}%
  \TestDiv{-2147483647}{1000}{-2147483}%
  \TestDiv{-2147483647}{-1000}{2147483}%
  \TestDiv{0}{3}{0}%
  \TestDiv{1}{3}{0}%
  \TestDiv{2}{3}{0}%
  \TestDiv{3}{3}{1}%
  \TestDiv{4}{3}{1}%
  \TestDiv{5}{3}{1}%
  \TestDiv{6}{3}{2}%
  \TestDiv{7}{3}{2}%
  \TestDiv{8}{3}{2}%
  \TestDiv{9}{3}{3}%
  \TestDiv{10}{3}{3}%
  \TestDiv{11}{3}{3}%
  \TestDiv{12}{3}{4}%
  \TestDiv{13}{3}{4}%
  \TestDiv{14}{3}{4}%
  \TestDiv{15}{3}{5}%
  \TestDiv{16}{3}{5}%
  \TestDiv{17}{3}{5}%
  \TestDiv{18}{3}{6}%
  \TestDiv{19}{3}{6}%
  \TestDiv{20}{3}{6}%
  \TestDiv{21}{3}{7}%
  \TestDiv{22}{3}{7}%
  \TestDiv{23}{3}{7}%
  \TestDiv{24}{3}{8}%
  \TestDiv{25}{3}{8}%
  \TestDiv{26}{3}{8}%
  \TestDiv{27}{3}{9}%
  \TestDiv{28}{3}{9}%
  \TestDiv{29}{3}{9}%
  \TestDiv{30}{3}{10}%
  \TestDiv{31}{3}{10}%
  \TestDivBig{17363436332507}{24702}{702916214}%
\end{qstest}

\begin{qstest}{mod}{mod}
  \TestMod{-6}{5}{4}%
  \TestMod{-5}{5}{0}%
  \TestMod{-4}{5}{1}%
  \TestMod{-3}{5}{2}%
  \TestMod{-2}{5}{3}%
  \TestMod{-1}{5}{4}%
  \TestMod{0}{5}{0}%
  \TestMod{1}{5}{1}%
  \TestMod{2}{5}{2}%
  \TestMod{3}{5}{3}%
  \TestMod{4}{5}{4}%
  \TestMod{5}{5}{0}%
  \TestMod{6}{5}{1}%
  \TestMod{-5}{4}{3}%
  \TestMod{-4}{4}{0}%
  \TestMod{-3}{4}{1}%
  \TestMod{-2}{4}{2}%
  \TestMod{-1}{4}{3}%
  \TestMod{0}{4}{0}%
  \TestMod{1}{4}{1}%
  \TestMod{2}{4}{2}%
  \TestMod{3}{4}{3}%
  \TestMod{4}{4}{0}%
  \TestMod{5}{4}{1}%
  \TestMod{-6}{-5}{-1}%
  \TestMod{-5}{-5}{0}%
  \TestMod{-4}{-5}{-4}%
  \TestMod{-3}{-5}{-3}%
  \TestMod{-2}{-5}{-2}%
  \TestMod{-1}{-5}{-1}%
  \TestMod{0}{-5}{0}%
  \TestMod{1}{-5}{-4}%
  \TestMod{2}{-5}{-3}%
  \TestMod{3}{-5}{-2}%
  \TestMod{4}{-5}{-1}%
  \TestMod{5}{-5}{0}%
  \TestMod{6}{-5}{-4}%
  \TestMod{-5}{-4}{-1}%
  \TestMod{-4}{-4}{0}%
  \TestMod{-3}{-4}{-3}%
  \TestMod{-2}{-4}{-2}%
  \TestMod{-1}{-4}{-1}%
  \TestMod{0}{-4}{0}%
  \TestMod{1}{-4}{-3}%
  \TestMod{2}{-4}{-2}%
  \TestMod{3}{-4}{-1}%
  \TestMod{4}{-4}{0}%
  \TestMod{5}{-4}{-3}%
  \TestMod{2147483647}{1000}{647}%
  \TestMod{2147483647}{-1000}{-353}%
  \TestMod{-2147483647}{1000}{353}%
  \TestMod{-2147483647}{-1000}{-647}%
  \TestMod{ 0 }{ 4 }{0}%
  \TestMod{ 1 }{ 4 }{1}%
  \TestMod{ -1 }{ 4 }{3}%
  \TestMod{ 0 }{ -4 }{0}%
  \TestMod{ 1 }{ -4 }{-3}%
  \TestMod{ -1 }{ -4 }{-1}%
  \TestMod{18362}{25}{12}%
\end{qstest}

\newcommand*{\TestError}[2]{%
  \begingroup
    \expandafter\def\csname BigIntCalcError:#1\endcsname{}%
    \Expect*{#2}{0}%
    \expandafter\def\csname BigIntCalcError:#1\endcsname{ERROR}%
    \Expect*{#2}{0ERROR}%
  \endgroup
}
\begin{qstest}{error}{error}
  \TestError{FacNegative}{\bigintcalcFac{-1}}%
  \TestError{FacNegative}{\bigintcalcFac{-2147483647}}%
  \TestError{DivisionByZero}{\bigintcalcPow{0}{-1}}%
  \TestError{DivisionByZero}{\bigintcalcDiv{1}{0}}%
  \TestError{DivisionByZero}{\bigintcalcMod{1}{0}}%
\end{qstest}

\begin{document}
\end{document}
\endinput
%%
%% End of file `bigintcalc-test2.tex'.
