%%
%% This is file `intcalc-test4.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% intcalc.dtx  (with options: `test4,etex')
%% 
%% This is a generated file.
%% 
%% Project: intcalc
%% Version: 2016/05/16 v1.2
%% 
%% Copyright (C) 2007 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 intcalc.dtx
%% and the derived files
%%    intcalc.sty, intcalc.pdf, intcalc.ins, intcalc.drv,
%%    intcalc-test1.tex, intcalc-test2.tex, intcalc-test3.tex,
%%    intcalc-test4.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\nofiles
\documentclass{article}
\makeatletter
\chardef\InCa@TestMode=1 %
\makeatother
\usepackage{intcalc}[2016/05/16]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
\newcommand*{\TestDo}[2]{%
  \ifcase\numexpr#2\relax
  \else
    \edef\temp{\intcalcMod{#1}{#2}}%
    \Expect*{%
      \the\numexpr
      \intcalcMul{%
        \intcalcDiv{\intcalcAbs{#1}}{\intcalcAbs{#2}}%
      }{\intcalcAbs{#2}}%
      +\intcalcMod{\intcalcAbs{#1}}{\intcalcAbs{#2}}\relax
    }*{\the\numexpr\intcalcAbs{#1}\relax}%
  \fi
}
\newcommand*{\TestOne}[2]{%
  \TestDo{#1}{#1}%
}
\newcommand*{\TestTwo}[3]{%
  \TestDo{#1}{#2}%
  \TestDo{#2}{#1}%
}
\let\TestNum\TestOne
\let\TestInv\TestOne
\let\TestAbs\TestOne
\let\TestSgn\TestOne
\let\TestMin\TestTwo
\let\TestMax\TestTwo
\let\TestCmp\TestTwo
\let\TestInc\TestOne
\let\TestDec\TestOne
\let\TestAdd\TestTwo
\let\TestSub\TestTwo
\let\TestShl\TestOne
\let\TestShr\TestOne
\let\TestMul\TestTwo
\let\TestSqr\TestOne
\def\TestFac#1#2{}
\let\TestPow\TestTwo
\let\TestDiv\TestTwo
\let\TestMod\TestTwo
\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}%
  \TestInv{-1}{1}%
  \TestInv{10}{-10}%
  \TestInv{-10}{10}%
  \TestInv{2147483647}{-2147483647}%
  \TestInv{-2147483647}{2147483647}%
  \TestInv{ 0 }{0}%
  \TestInv{ 1 }{-1}%
  \TestInv{--1}{-1}%
  \TestInv{\z@}{0}%
  \TestInv{\@ne}{-1}%
  \TestInv{\m@ne}{1}%
  \TestInv{-10+30}{-20}%
  \TestInv{10-30}{20}%
\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{ 0 }{0}%
  \TestAbs{ 1 }{1}%
  \TestAbs{--1}{1}%
  \TestAbs{\z@}{0}%
  \TestAbs{\@ne}{1}%
  \TestAbs{\m@ne}{1}%
  \TestAbs{-10+30}{20}%
  \TestAbs{10-30}{20}%
\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{ 0 }{0}%
  \TestSgn{ 2 }{1}%
  \TestSgn{ -2 }{-1}%
  \TestSgn{--2}{1}%
  \TestSgn{\z@}{0}%
  \TestSgn{\@ne}{1}%
  \TestSgn{\m@ne}{-1}%
  \TestSgn{-10+30}{1}%
  \TestSgn{10-30}{-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{\z@}{\@ne}{0}%
  \TestMin{\@ne}{\m@ne}{-1}%
  \TestMin{1+2}{3+4}{3}%
\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{\z@}{\@ne}{1}%
  \TestMax{\@ne}{\m@ne}{1}%
  \TestMax{1+2}{3+4}{7}%
\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{2147483647}{-2147483647}{1}%
  \TestCmp{-2147483647}{2147483647}{-1}%
  \TestCmp{2147483647}{2147483647}{0}%
  \TestCmp{\z@}{\@ne}{-1}%
  \TestCmp{\@ne}{\m@ne}{1}%
  \TestCmp{ 4 }{ 5 }{-1}%
  \TestCmp{ -3 }{ -7 }{1}%
  \TestCmp{1+2}{3+4}{-1}%
\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}%
\end{qstest}

\begin{qstest}{inc}{inc}%
  \TestInc{0}{1}%
  \TestInc{1}{2}%
  \TestInc{-1}{0}%
  \TestInc{10}{11}%
  \TestInc{-10}{-9}%
  \TestInc{999}{1000}%
  \TestInc{-1000}{-999}%
  \TestInc{129}{130}%
  \TestInc{2147483646}{2147483647}%
  \TestInc{-2147483647}{-2147483646}%
\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}%
\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}%
  \TestAdd{100}{50+150}{300}%
  \TestAdd{2147483647}{10-2147483647}{10}%
\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}%
  \TestSub{100}{50+150}{-100}%
  \TestSub{2147483647}{-10+2147483647}{10}%
\end{qstest}

\begin{qstest}{shl}{shl}
  \TestShl{0}{0}%
  \TestShl{1}{2}%
  \TestShl{5621}{11242}%
  \TestShl{1073741823}{2147483646}%
  \TestShl{-1}{-2}%
  \TestShl{-5621}{-11242}%
\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}%
  \TestShr{-1}{0}%
  \TestShr{-2}{-1}%
  \TestShr{-3}{-1}%
  \TestShr{-11241}{-5620}%
\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{2+3}{5+7}{60}%
  \TestMul{2147483647}{2147483647/2147483647}{2147483647}%
\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}{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}%
\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{1+2}{1+3}{3}%
  \TestMod{1-2}{1+3}{3}%
  \TestMod{1-2}{1-4}{-1}%
  \TestMod{1+2}{1-4}{0}%
  \TestMod{1+2}{1-5}{-1}%
\end{qstest}
\begin{document}
\end{document}
\endinput
%%
%% End of file `intcalc-test4.tex'.
