%%
%% This is file `alphalph-test3.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% alphalph.dtx  (with options: `test2,noetex')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 1999, 2006-2008 by
%%    Heiko Oberdiek <oberdiek@uni-freiburg.de>
%% 
%% 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 alphalph.dtx
%% and the derived files
%%    alphalph.sty, alphalph.pdf, alphalph.ins, alphalph.drv,
%%    alphalph-test1.tex, alphalph-test2.tex, alphalph-test3.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\nofiles
\documentclass{article}
\makeatletter
\let\saved@numexpr\numexpr
\newcommand*{\DisableNumexpr}{%
  \let\numexpr\@undefined
}
\newcommand*{\RestoreNumexpr}{%
  \let\numexpr\saved@numexpr
}
\DisableNumexpr
\usepackage{alphalph}[2008/08/11]
\RestoreNumexpr
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}

\newcommand*{\TestCmd}[3]{%
  \setbox0=\hbox{%
    \DisableNumexpr
    \edef\TestString{#1{#2}}%
    \expandafter\Expect\expandafter{\TestString}{#3}%
    \edef\TestString{#1{#2} }%
    \expandafter\Expect\expandafter{\TestString}{#3 }%
  }%
  \Expect*{\the\wd0}{0.0pt}%
}

\makeatletter
\newalphalph\LaTeXAlphAlph\@Alph{26}
\newalphalph\LaTeXalphalph\@alph{26}
\newalphalph\AlphWrap[wrap]\alphalph@Alph{26}
\newalphalph\alphwrap[wrap]\alphalph@alph{26}
\newalphalph\LaTeXAlphWrap[wrap]\@Alph{26}
\newalphalph\LaTeXalphwrap[wrap]\@alph{26}
\def\LastSymbol#1{%
  \ifx\\#1\\%
  \else
    \@LastSymbol#1\@nil
  \fi
}
\def\@LastSymbol#1#2\@nil{%
  \ifx\\#2\\%
    #1%
  \else
    \@LastSymbol#2\@nil
  \fi
}
\makeatother
\newcommand*{\TestAlph}[2]{%
  \uppercase{\TestCallCmd\AlphAlph{#2}}{#1}%
  \lowercase{\TestCallCmd\alphalph{#2}}{#1}%
  \uppercase{\TestCallCmd\LaTeXAlphAlph{#2}}{#1}%
  \lowercase{\TestCallCmd\LaTeXalphalph{#2}}{#1}%
  \edef\WrapString{\LastSymbol{#2}}%
  \expandafter\TestAlphWrap\expandafter{\WrapString}{#1}%
}
\newcommand*{\TestAlphWrap}[2]{%
  \uppercase{\TestCallCmd\AlphWrap{#1}}{#2}%
  \lowercase{\TestCallCmd\alphwrap{#1}}{#2}%
  \uppercase{\TestCallCmd\LaTeXAlphWrap{#1}}{#2}%
  \lowercase{\TestCallCmd\LaTeXalphwrap{#1}}{#2}%
}
\newcommand*{\TestCallCmd}[3]{%
  \TestCmd#1{#3}{#2}%
}
\begin{qstest}{AlphSymbols}{alphalph, AlphAlph, symbols}
  \TestAlph{1}{a}%
  \TestAlph{2}{b}%
  \TestAlph{3}{c}%
  \TestAlph{4}{d}%
  \TestAlph{5}{e}%
  \TestAlph{6}{f}%
  \TestAlph{7}{g}%
  \TestAlph{8}{h}%
  \TestAlph{9}{i}%
  \TestAlph{10}{j}%
  \TestAlph{11}{k}%
  \TestAlph{12}{l}%
  \TestAlph{13}{m}%
  \TestAlph{14}{n}%
  \TestAlph{15}{o}%
  \TestAlph{16}{p}%
  \TestAlph{17}{q}%
  \TestAlph{18}{r}%
  \TestAlph{19}{s}%
  \TestAlph{20}{t}%
  \TestAlph{21}{u}%
  \TestAlph{22}{v}%
  \TestAlph{23}{w}%
  \TestAlph{24}{x}%
  \TestAlph{25}{y}%
  \TestAlph{26}{z}%
\end{qstest}
\begin{qstest}{AlphRange}{alphalph, range}
  \TestAlph{0}{}%
  \TestAlph{-1}{}%
  \TestAlph{-2147483647}{}%
  \TestAlph{27}{aa}%
  \TestAlph{28}{ab}%
  \TestAlph{52}{az}%
  \TestAlph{53}{ba}%
  \TestAlph{78}{bz}%
  \TestAlph{79}{ca}%
  \TestAlph{702}{zz}%
  \TestAlph{703}{aaa}%
  \TestAlph{2147483647}{fxshrxw}%
\end{qstest}

\makeatletter
\newcommand*{\myvocals}[1]{%
  \ifcase#1X\or A\or E\or I\or O\or U\else Y\fi
}
\makeatother
\newalphalph\vocalsvocals\myvocals{5}
\newcommand*{\TestVocals}{%
  \TestCmd\vocalsvocals
}
\begin{qstest}{vocals}{vocals}
  \TestVocals{0}{}%
  \TestVocals{1}{A}%
  \TestVocals{2}{E}%
  \TestVocals{3}{I}%
  \TestVocals{4}{O}%
  \TestVocals{5}{U}%
  \TestVocals{6}{AA}%
  \TestVocals{7}{AE}%
  \TestVocals{8}{AI}%
  \TestVocals{9}{AO}%
  \TestVocals{10}{AU}%
  \TestVocals{11}{EA}%
  \TestVocals{24}{OO}%
  \TestVocals{25}{OU}%
  \TestVocals{26}{UA}%
  \TestVocals{29}{UO}%
  \TestVocals{30}{UU}%
  \TestVocals{31}{AAA}%
  \TestVocals{155}{UUU}%
  \TestVocals{156}{AAAA}%
  \TestVocals{2147483647}{AIIOOEEIOIIUOE}%
\end{qstest}

\makeatletter
\newalphalph\AlphMult[mult]{\alphalph@Alph}{26}
\newalphalph\alphmult[mult]{\alphalph@alph}{26}
\newalphalph\LaTeXAlphMult[mult]{\@Alph}{26}
\newalphalph\LaTeXalphmult[mult]{\@alph}{26}
\makeatother
\newcommand*{\TestMult}[2]{%
  \uppercase{\TestCallCmd\AlphMult{#2}}{#1}%
  \lowercase{\TestCallCmd\alphmult{#2}}{#1}%
  \uppercase{\TestCallCmd\LaTeXAlphMult{#2}}{#1}%
  \lowercase{\TestCallCmd\LaTeXalphmult{#2}}{#1}%
}
\begin{qstest}{mult}{mult}
  \TestMult{0}{}%
  \TestMult{-1}{}%
  \TestMult{-2147483647}{}%
  \TestMult{1}{a}%
  \TestMult{2}{b}%
  \TestMult{26}{z}%
  \TestMult{27}{aa}%
  \TestMult{28}{bb}%
  \TestMult{52}{zz}%
  \TestMult{53}{aaa}%
  \TestMult{54}{bbb}%
  \TestMult{259}{yyyyyyyyyy}%
  \TestMult{260}{zzzzzzzzzz}%
  \TestMult{261}{aaaaaaaaaaa}%
  \TestMult{262}{bbbbbbbbbbb}%
\end{qstest}

\def\myvocalsB#1{%
  \ifcase#1\or A\or E\or I\or O\or U\fi
}
\begin{qstest}{symbolnum}{symbolnum}
  \makeatletter
  \def\Test#1#2{%
    \let\TestCmd\relax
    \newalphalph\TestCmd{#1}{}%
    \Expect*{\AlPh@Number}{#2}%
  }%
  \Test\@alph{26}%
  \Test\@Alph{26}%
  \Test\@fnsymbol{9}%
  \Test\myvocalsB{5}%
  \Test\alphalph@alph{26}%
  \Test\alphalph@Alph{26}%
\end{qstest}

\begin{qstest}{list}{list}
  \makeatletter
  \def\catch#1\relax{%
    \def\FoundList{\catch#1}%
  }%
  \def\Test[#1]#2#3#4{%
    \let\testcmd\relax
    \newalphalph\testcmd[{#1}]{\catch}{#2}%
    \testcmd{#3}|\relax
    \expandafter\Expect\expandafter{\FoundList}{#4|}%
    %
    \let\SavedCatch\catch
    \def\catch{\noexpand\catch\noexpand\foo}%
    \edef\Result{#4|}%
    \@onelevel@sanitize\Result
    \let\catch\SavedCatch
    \let\testcmd\relax
    \newalphalph\testcmd[{#1}]{\catch\foo}{#2}%
    \testcmd{#3}|\relax
    \@onelevel@sanitize\FoundList
    \Expect*{\FoundList}*{\Result}%
  }%
  \Test[alph]{26}{3}{\catch{3}}%
  \Test[alph]{26}{12}{\catch{12}}%
  \Test[alph]{26}{27}{\catch{1}\catch{1}}%
  \Test[alph]{26}{78}{\catch{2}\catch{26}}%
  \Test[wrap]{26}{7}{\catch{7}}%
  \Test[wrap]{26}{14}{\catch{14}}%
  \Test[wrap]{26}{80}{\catch{2}}%
  \Test[wrap]{26}{700}{\catch{24}}%
  \Test[mult]{26}{4}{\catch{4}}%
  \Test[mult]{26}{17}{\catch{17}}%
  \Test[mult]{26}{54}{\catch{2}\catch{2}\catch{2}}%
\end{qstest}

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