%%
%% This is file `kvsetkeys-test3.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% kvsetkeys.dtx  (with options: `test2,noetex')
%% 
%% This is a generated file.
%% 
%% Project: kvsetkeys
%% Version: 2012/04/25 v1.16
%% 
%% Copyright (C) 2006, 2007, 2009-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 kvsetkeys.dtx
%% and the derived files
%%    kvsetkeys.sty, kvsetkeys.pdf, kvsetkeys.ins, kvsetkeys.drv,
%%    kvsetkeys-example.tex, kvsetkeys-test1.tex,
%%    kvsetkeys-test2.tex, kvsetkeys-test3.tex,
%%    kvsetkeys-test4.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\nofiles
\documentclass{article}
\let\SavedUnexpanded\unexpanded
\let\unexpanded\UNDEFINED
\makeatletter
\chardef\KVS@TestMode=1 %
\makeatother
\usepackage{kvsetkeys}[2012/04/25]
\let\unexpanded\SavedUnexpanded
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
\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
\def\@makeactive#1{%
  \catcode`#1=13\relax
}
\@makeactive\,
\def,{\errmessage{COMMA}}
\@makeother\,
\@makeactive\=
\def={\errmessage{EQUALS}}
\@makeother\=

\begin{qstest}{normalize}{normalize,active-chars,space-removal}%
  \long\def\Test#1#2{%
    \@makeother\,%
    \@makeother\=%
    \scantokens{\toks@={#2}}%
    \edef\Result{\the\toks@}%
    \@makeother\,%
    \@makeother\=%
    \@Test{#1}%
    \@makeactive\,%
    \@Test{#1}%
    \@makeactive\=%
    \@Test{#1}%
    \@makeother\,%
    \@Test{#1}%
    \@makeother\=%
  }%
  \long\def\@Test#1{%
    \scantokens{\kv@normalize{#1}}%
    \expandafter\expandafter\expandafter\Expect
    \expandafter\expandafter\expandafter
    {\expandafter\kv@list\expandafter}\expandafter{\Result}%
    \Expect*{\ifx\kv@list\Result true\else false\fi}{true}%
  }%
  \Test{}{,}%
  \Test{,}{,}%
  \Test{,,}{,}%
  \Test{,,,}{,}%
  \Test{ , }{,}%
  \Test{{a}}{,{a},}%
  \Test{,{a}}{,{a},}%
  \Test{{a},}{,{a},}%
  \Test{{a},{b}}{,{a},{b},}%
  \Test{{b}={c},{}=,{}={},{d}=}{,{b}={c},{}=,{}={},{d}=,}%
  \Test{{}}{,{},}%
  \Test{{},{},{}}{,{},{},{},}%
  \Test{=}{,=,}%
  \Test{=,=,=}{,=,=,=,}%
  \Test{a=\par}{,a=\par,}%
  \Test{\par}{,\par,}%
  \def\TestSet#1{%
    \Test{#1#1}{,}%
    \Test{#1#1,#1#1}{,}%
    \Test{#1#1,#1#1,#1#1}{,}%
    \Test{#1#1#1#1#1}{,}%
    \Test{{a}#1#1=#1#1{b}}{,{a}={b},}%
  }%
  \TestSet{ }%
  \begingroup
    \let\saved@normalize\kv@normalize
    \def\kv@normalize#1{%
      \saved@normalize{#1}%
      \@onelevel@sanitize\kv@list
      \@onelevel@sanitize\Result
    }%
    \Test{#,#=#,{#}={#},{#}=,{#}}{,#,#=#,{#}={#},{#}=,{#},}%
  \endgroup
  \begingroup
    \def\Test#1#2{%
      \edef\Result{#2}%
      \@Test{#1}%
    }%
    \Test{{ a = b }}{,{ a = b },}%
    \@makeactive\,%
    \Test{{,}}{\string,{\noexpand,}\string,}%
    \@makeother\,%
    \@makeactive\=%
    \Test{a={=}}{,a\string={\noexpand=},}%
  \endgroup
  \Test{a=b}{,a=b,}%
  \Test{a={b}}{,a={b},}%
  \Test{a ={b}}{,a={b},}%
  \Test{a= {b}}{,a={b},}%
  \Test{a = {b}}{,a={b},}%
  \Test{a = {b} ,}{,a={b},}%
  \Test{a}{,a,}%
  \Test{ a}{,a,}%
  \Test{a }{,a,}%
  \Test{ a }{,a,}%
  \Test{, a ,}{,a,}%
  \Test{, a b ,}{,a b,}%
  \Test{,a ,}{,a,}%
  \Test{ a =}{,a=,}%
  \Test{ a = }{,a=,}%
  \Test{a =}{,a=,}%
  \Test{{a} =}{,{a}=,}%
  \Test{{a}= {}}{,{a}={},}%
  \Test{, a = {}}{,a={},}%
  \Test{a,,b}{,a,b,}%
  \Test{a=\fi}{,a=\fi,}%
  \Test{a=\iffalse}{,a=\iffalse,}%
  \Test{a=\iffalse,b=\fi}{,a=\iffalse,b=\fi,}%
\end{qstest}

\begin{qstest}{parse}{parse,brace-removal}
  \def\Processor#1#2{%
    \expandafter\Expect\expandafter{\kv@key}{#1}%
    \toks@{#2}%
    \edef\x{\the\toks@}%
    \ifx\kv@value\relax
      \Expect*{\the\toks@}{}%
      \def\Value{<>}%
    \else
      \edef\Value{[\the\toks@]}%
      \@onelevel@sanitize\Value
    \fi
    \toks@{#1}%
    \ifx\Result\@empty
      \edef\Result{[\the\toks@]=\Value}%
    \else
      \edef\Result{\Result,[\the\toks@]=\Value}%
    \fi
    \@onelevel@sanitize\Result
  }%
  \def\Test#1#2{%
    \sbox0{%
      \let\Result\@empty
      \kv@parse{#1}\Processor
      \Expect*{\Result}{#2}%
    }%
    \Expect*{\the\wd0}{0.0pt}%
  }%
  \Test{}{}%
  \Test{{}}{}%
  \Test{{{}}}{[]=<>}%
  \Test{{{{}}}}{[{}]=<>}%
  \Test{a}{[a]=<>}%
  \Test{{a}}{[a]=<>}%
  \Test{{a}}{[a]=<>}%
  \Test{{{a}}}{[a]=<>}%
  \Test{{{{a}}}}{[{a}]=<>}%
  \Test{a=}{[a]=[]}%
  \Test{{a}=}{[a]=[]}%
  \Test{{{a}}=}{[{a}]=[]}%
  \Test{a={}}{[a]=[]}%
  \Test{{a}={{}}}{[a]=[{}]}%
  \Test{a=b}{[a]=[b]}%
  \Test{a=\fi}{[a]=[\fi]}%
  \Test{a=\iffalse}{[a]=[\iffalse]}%
  \Test{a=\iffalse,b=\fi}{[a]=[\iffalse],[b]=[\fi]}%
  \Test{{ a = b }}{[ a ]=[ b ]}%
  \Test{{{ a = b }}}{[ a = b ]=<>}%
\end{qstest}

\begin{qstest}{comma}{comma,parse}
  \def\Processor#1{%
    \expandafter\Expect\expandafter{\comma@entry}{#1}%
    \toks@{#1}%
    \ifx\Result\@empty
      \edef\Result{[\the\toks@]}%
    \else
      \edef\Result{\Result,[\the\toks@]}%
    \fi
    \@onelevel@sanitize\Result
  }%
  \def\Test#1#2{%
    \sbox0{%
      \let\Result\@empty
      \comma@parse{#1}\Processor
      \Expect*{\Result}{#2}%
    }%
    \Expect*{\the\wd0}{0.0pt}%
  }%
  \Test{}{}%
  \Test{{}}{}%
  \Test{{{}}}{[{}]}%
  \Test{a}{[a]}%
  \Test{{a}}{[a]}%
  \Test{{{a}}}{[{a}]}%
  \Test{a=}{[a=]}%
  \Test{a\fi}{[a\fi]}%
  \Test{a\iffalse}{[a\iffalse]}%
  \Test{\iffalse,\fi}{[\iffalse],[\fi]}%
  \Test{ a , b , c }{[a],[b],[c]}%
  \Test{ { } ,{ }, { }, { } , { } }{[ ],[ ],[ ],[ ],[ ]}%
  \Test{ {{}} ,{{}}, {{}}, {{}} , {{}} }{[{}],[{}],[{}],[{}],[{}]}%
\end{qstest}

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