%% %% This is file `pdfescape-test2.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% pdfescape.dtx (with options: `test2') %% %% This is a generated file. %% %% Project: pdfescape %% Version: 2011/11/25 v1.13 %% %% Copyright (C) 2007, 2010, 2011 by %% Heiko Oberdiek %% %% 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 pdfescape.dtx %% and the derived files %% pdfescape.sty, pdfescape.pdf, pdfescape.ins, pdfescape.drv, %% pdfescape-test1.tex, pdfescape-test2.tex, %% pdfescape-test3.tex, pdfescape-test4.tex, %% pdfescape-test5.tex, pdfescape-test6.tex. %% \NeedsTeXFormat{LaTeX2e} \makeatletter \ProvidesFile{pdfescape-test2.tex}% [2011/11/25 v1.13 Test with \string\pdfescape... commands]% \@ifundefined{pdfescapehex}{% \PackageError{pdfescape-test2}{% Missing \string\pdfescape... commands% }{Test aborted.}% \stop }{} \RequirePackage{qstest} \IncludeTests{*} \LogTests{log}{*}{*} \newcommand*{\ExpectVar}[2]{% \ifx#1#2% \else \begingroup \@onelevel@sanitize#1% \@onelevel@sanitize#2% \typeout{[#1] <> [#2]}% hash-ok \endgroup \fi \Expect*{\ifx#1#2true\else false\fi}{true}% } \makeatletter \begingroup \gdef\AllBytes{}% \count@=0 % \catcode0=12 % \@whilenum\count@<256 \do{% \lccode0=\count@ \ifnum\count@=32 % \xdef\AllBytes{\AllBytes\space}% \else \lowercase{% \xdef\AllBytes{\AllBytes^^@}% }% \fi \advance\count@ by 1 % }% \endgroup \newcommand*{\AllBytesHex}{% 000102030405060708090A0B0C0D0E0F% 101112131415161718191A1B1C1D1E1F% 202122232425262728292A2B2C2D2E2F% 303132333435363738393A3B3C3D3E3F% 404142434445464748494A4B4C4D4E4F% 505152535455565758595A5B5C5D5E5F% 606162636465666768696A6B6C6D6E6F% 707172737475767778797A7B7C7D7E7F% 808182838485868788898A8B8C8D8E8F% 909192939495969798999A9B9C9D9E9F% A0A1A2A3A4A5A6A7A8A9AAABACADAEAF% B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF% C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF% D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF% E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF% F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF% } \@onelevel@sanitize\AllBytesHex \expandafter\lowercase\expandafter{% \expandafter\newcommand\expandafter*\expandafter\AllBytesHexLC \expandafter{\AllBytesHex}% } \newcommand*{\AllBytesName}{} \begingroup \catcode`\#=12 % \xdef\AllBytesName{% #01#02#03#04#05#06#07#08#09#0A#0B#0C#0D#0E#0F% #10#11#12#13#14#15#16#17#18#19#1A#1B#1C#1D#1E#1F% #20!"#23$#25&'#28#29*+,-.#2F% 0123456789:;#3C=#3E?% @ABCDEFGHIJKLMNO% PQRSTUVWXYZ#5B\@backslashchar#5D^_% `abcdefghijklmno% pqrstuvwxyz#7B|#7D\string~#7F% #80#81#82#83#84#85#86#87#88#89#8A#8B#8C#8D#8E#8F% #90#91#92#93#94#95#96#97#98#99#9A#9B#9C#9D#9E#9F% #A0#A1#A2#A3#A4#A5#A6#A7#A8#A9#AA#AB#AC#AD#AE#AF% #B0#B1#B2#B3#B4#B5#B6#B7#B8#B9#BA#BB#BC#BD#BE#BF% #C0#C1#C2#C3#C4#C5#C6#C7#C8#C9#CA#CB#CC#CD#CE#CF% #D0#D1#D2#D3#D4#D5#D6#D7#D8#D9#DA#DB#DC#DD#DE#DF% #E0#E1#E2#E3#E4#E5#E6#E7#E8#E9#EA#EB#EC#ED#EE#EF% #F0#F1#F2#F3#F4#F5#F6#F7#F8#F9#FA#FB#FC#FD#FE#FF% }% \endgroup \@onelevel@sanitize\AllBytesName \newcommand*{\AllBytesString}{} \begingroup \def\|{|}% \edef\%{\@percentchar}% \catcode`\|=0 % \catcode`\#=12 % \catcode`\~=12 % \catcode`\\=12 % |xdef|AllBytesString{% \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017% \020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037% \040!"#$|%&'\(\)*+,-./% 0123456789:;<=>?% @ABCDEFGHIJKLMNO% PQRSTUVWXYZ[\\]^_% `abcdefghijklmno% pqrstuvwxyz{||}~\177% \200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217% \220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237% \240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257% \260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277% \300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317% \320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337% \340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357% \360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377% }% |endgroup \@onelevel@sanitize\AllBytesString \RequirePackage{pdfescape} \begin{qstest}{all-hex}{\AllBytes, escapehex} \EdefEscapeHex\x{\AllBytes}% \Expect*{\x}*{\AllBytesHex}% \ExpectVar\x\AllBytesHex \end{qstest} \begin{qstest}{all-unhex}{\AllBytesHex, unescapehex} \EdefUnescapeHex\x{\AllBytesHex}% \Expect*{\x}*{\AllBytes}% \ExpectVar\x\AllBytes \end{qstest} \begin{qstest}{all-unhex-lc}{\AllBytesHexLC, unescapehex, lowercase} \EdefUnescapeHex\x{\AllBytesHexLC}% \Expect*{\x}*{\AllBytes}% \ExpectVar\x\AllBytes \end{qstest} \begin{qstest}{unhex-incomplete}{unescapehex, incomplete} \EdefUnescapeHex\x{4}% \Expect*{\x}{@}% \end{qstest} \begin{qstest}{unhex-space}{unescapehex, space} \EdefUnescapeHex\x{20}% \Expect*{\x}{ }% \ExpectVar\x\space \end{qstest} \begin{qstest}{unhex-spaces}{unescapehex, spaces} \EdefUnescapeHex\x{204020204120}% \def\y#1{% \edef\z{#1\string @#1#1\string A#1}% }\y{ }% \Expect*{\x}*{\z}% \ExpectVar\x\z \end{qstest} \begin{qstest}{unhex-hash}{unescapehex, hash} \catcode`\#=12 % \EdefUnescapeHex\x{#20}% \ExpectVar\x\space \end{qstest} \begin{qstest}{unhex-invalid}{unescapehex, invalid} \def\test#1#2{% \EdefUnescapeHex\x{#1}% \edef\y{#2}% \@onelevel@sanitize\y \ExpectVar\x\y }% \edef\x{\pdfunescapehex{4X}}% \edef\y{\string @}% \ifx\x\y \else \def~{\space}% \typeout{************************************}% \typeout{* Your pdfTeX contains bug 777.~~~~*}% \typeout{* This test is redefined as dummy, *}% \typeout{* because it triggers the bug.~~~~~*}% \typeout{************************************}% \def\test#1#2{}% \fi \test{X}{}% \test{XY}{}% \test{XYZ}{}% \test{A}{^^a0}% \test{AX}{^^a0}% \test{XA}{^^a0}% \test{XXAXX}{^^a0}% \end{qstest} \begin{qstest}{all-name}{\AllBytes, escapename} \EdefEscapeName\x{\AllBytes}% \Expect*{\x}*{\AllBytesName}% \ExpectVar\x\AllBytesName \end{qstest} \begin{qstest}{all-string}{\AllBytes, escapestring} \EdefEscapeString\x{\AllBytes}% \Expect*{\x}*{\AllBytesString}% \ExpectVar\x\AllBytesString \end{qstest} \begin{qstest}{uchexdigit}{unescape, uppercase hex digit} \catcode`\@=11 % \catcode0=12 % \def\test#1#2{% \uccode0=#1\relax \uppercase{% \def\x{^^@}% }% \Expect*{% \ifcase\expandafter\PE@TestUcHexDigit\x true% \else false% \fi }{#2}% }% \def\range#1#2#3{% \count0=#1\relax \loop \ifnum\count0<#2\relax \test{\count0}{#3}% \advance\count0 by 1 % \repeat }% \range{0}{47}{false}% \range{48}{57}{true}% \range{58}{64}{false}% \range{65}{70}{true}% \range{71}{255}{false}% \end{qstest} \begin{qstest}{unescapename}{unescapename} \def\test#1#2{% \EdefUnescapeName\x{#1}% \edef\y{#2}% \@onelevel@sanitize\y \ExpectVar\x\y }% \catcode`\#=12 % \catcode0=12 % \test{}{}% \test{x}{x}% \test{xy}{xy}% \test{#}{#}% \test{##}{##}% \test{###}{###}% \test{####}{####}% \test{#x}{#x}% \test{#xy}{#xy}% \test{#1}{#1}% \test{#40}{@}% \test{#400}{@0}% \test{#4x0}{#4x0}% \test{#ab}{^^ab}% \test{#00}{^^@}% \test{x#40y#40z}{x@y@z}% \test{#40#40#40#40}{@@@@}% \test{a#x}{a#x}% \test{a#xy}{a#xy}% \test{a#1}{a#1}% \test{a#40}{a@}% \test{a#400}{a@0}% \test{#20}{ }% \test{a#20}{a }% \test{a#20b}{a b}% \test{a#20#20#20b}{a \space\space b}% \end{qstest} \begin{qstest}{unescapestring}{unescapestring} \def\test#1#2{% \EdefUnescapeString\x{#1}% \edef\y{#2}% \@onelevel@sanitize\y \ExpectVar\x\y }% \catcode0=12 % \def\DefChar#1#2{% \begingroup \uccode0=#2\relax \uppercase{\endgroup \def#1{^^@}% }% }% \DefChar\nul{0}% \DefChar\one{1}% \DefChar\bel{8}% \DefChar\tab{9}% \DefChar\lf{10}% \DefChar\ff{12}% \DefChar\cr{13}% \DefChar\\{92}% \test{}{}% \test{a}{a}% \test{\\}{}% \test{\\\\}{\\}% \test{\\\\y}{\\y}% \test{\\000}{\nul}% \test{\\b}{\bel}% \test{\\t}{\tab}% \test{\\n}{\lf}% \test{\\f}{\ff}% \test{\\r}{\cr}% \test{\\(}{(}% \test{\\)}{)}% \test{\\040}{ }% \test{\\100}{@}% \test{\\40}{ }% \test{\\1}{\one}% \test{\\01}{\one}% \test{\\001}{\one}% \test{\\18}{\one8}% \test{\\018}{\one8}% \test{\\0018}{\one8}% \test{x\\}{x}% \test{x\\\\}{x\\}% \test{x\\\\y}{x\\y}% \test{x\\000}{x\nul}% \test{x\\b}{x\bel}% \test{x\\t}{x\tab}% \test{x\\n}{x\lf}% \test{x\\f}{x\ff}% \test{x\\r}{x\cr}% \test{x\\(}{x(}% \test{x\\)}{x)}% \test{x\\040}{x }% \test{x\\100}{x@}% \test{x\\40}{x }% \test{x\\1}{x\one}% \test{x\\01}{x\one}% \test{x\\001}{x\one}% \test{x\\18}{x\one8}% \test{x\\018}{x\one8}% \test{x\\0018}{x\one8}% \test{\\b\\t\\n\\f\\r\\(\\)\\\\\\000\\040}{% \bel\tab\lf\ff\cr()\\\nul\space }% \test{\\\lf}{}% \test{x\\\lf}{x}% \test{\cr}{\lf}% \test{\cr\lf}{\lf}% \test{\lf}{\lf}% \test{\lf\cr}{\lf\lf}% \test{x\cr}{x\lf}% \test{x\cr\lf}{x\lf}% \test{x\lf}{x\lf}% \test{x\lf\cr}{x\lf\lf}% \test{x\\\cr\lf y\cr}{xy\lf}% \test{\\409}{ 9}% \test{\\800}{800}% \test{\\900}{900}% \test{\\578}{/8}% \test{\\477}{?}% \test{\\377}{^^ff}% \test{\\777}{^^ff}% \test{\\7777}{^^ff7}% \end{qstest} \stop \endinput %% %% End of file `pdfescape-test2.tex'.