Created
October 8, 2021 06:56
-
-
Save zr-tex8r/34e55882e4946539144ab84d6691b502 to your computer and use it in GitHub Desktop.
TeX:\if の抜き打ちテストを実際に実行してみる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\countdef\QN=255 \QN=0 | |
\def\TEST#1{\advance\QN1 \immediate\write16 | |
{\the\QN. #1True\else False\fi}} | |
% preconditions | |
\let\a=a | |
\let\b=a | |
\def\c{c} | |
\chardef\d=`d | |
\let\primA\indent | |
\chardef\chardefA=42 | |
\newcount\countA \countA=42 | |
\def\macroA{42} | |
\def\empty{} | |
\let\X\relax | |
\catcode`\X=13 \def X{c} | |
\catcode`\Y=13 \let Y=c | |
\catcode`\Z=13 \let Z\advance | |
\catcode`\&=13 \let &\expandafter | |
\catcode`\?=13 \let ?\undefinedA | |
% the tests | |
\TEST{\if a\a} | |
\TEST{\if b\b} | |
\TEST{\if \a\b} | |
\TEST{\if 42} | |
\TEST{\if c\c} | |
\TEST{\if ""} | |
\TEST{\if \empty{}} | |
\TEST{\if \indent\noindent} | |
\TEST{\if \countA\chardefA} | |
\TEST{\if \empty\macroA} | |
\TEST{\if a\noexpand\a} | |
\TEST{\if b\noexpand\b} | |
\TEST{\if c\noexpand\c} | |
\TEST{\if \primA\noexpand\macroA} | |
\TEST{\if \noexpand\empty\noexpand\macroA} | |
\TEST{\if \noexpand'\string'} | |
\TEST{\if \noexpand\undefinedA\noexpand\undefinedB} | |
\TEST{\if \noexpand$\relax} | |
\TEST{\if \noexpand\macroA\countA} | |
\TEST{\if \noexpand\c\noexpand\undefinedA} | |
\TEST{\if \noexpand\undefinedB\noexpand\a} | |
\TEST{\if d\d} | |
\TEST{\if XY} | |
\TEST{\if \string X\noexpand X} | |
\TEST{\if \noexpandY\stringY} | |
\TEST{\if \noexpandX\relax} | |
\TEST{\if \noexpandX\c} | |
\TEST{\if \noexpandX\noexpand\c} | |
\TEST{\if \noexpandX\chardefA} | |
\TEST{\if \noexpandYc} | |
\TEST{\if \noexpandY\primA} | |
\TEST{\if \noexpandY\string c} | |
\TEST{\if \noexpandY\countA} | |
\TEST{\if \noexpandZ\multiply} | |
\TEST{\if \noexpandZ\noexpand\undefinedA} | |
\TEST{\if \noexpandZ\stringZ} | |
\TEST{\if \noexpand&\noexpand\futurelet} | |
\TEST{\if \noexpand&\noexpand\undefinedA} | |
\TEST{\if \noexpand&\string&} | |
\TEST{\if \noexpand?\noexpand\undefinedB} | |
\TEST{\if \noexpandX\noexpandY} | |
\TEST{\if \noexpand?\noexpand&} | |
% done | |
\csname stop\endcsname % for LaTeX | |
\end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参照→ じゃあ \if の抜き打ちテストやるぞー ― マクロツイーター