Skip to content

Commit

Permalink
Modify Tests in Tex (#4415)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Jan 28, 2025
1 parent 917b6b1 commit 536d420
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
15 changes: 10 additions & 5 deletions archive/t/tex/fizz-buzz.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
%&pdftex
% Source: https://rosettacode.org/wiki/String_append#Plain_TeX
\def\addtomacro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}

\newwrite\out
\immediate\openout\out=fizz-buzz.txt

\countdef\counter=1
\countdef\threecounter=2
Expand All @@ -9,22 +13,23 @@

\loop
\def\printnum{1}
\def\result{}
\noindent
\ifnum \threecounter>2
Fizz%
\addtomacro\result{Fizz}
\threecounter=0
\def\printnum{0}
\fi
\ifnum \fivecounter>4
Buzz%
\addtomacro\result{Buzz}
\fivecounter=0
\def\printnum{0}
\fi
\ifnum\printnum=1
% print the counter variable
\the\counter%
\addtomacro\result{\the\counter}
\fi
\hfil \break
\immediate\write\out{\result}
\advance \counter 1
\advance \threecounter 1
\advance \fivecounter 1
Expand Down
6 changes: 3 additions & 3 deletions archive/t/tex/hello-world.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%&pdftex

Hello, World!
\newwrite\out
\immediate\openout\out=hello-world.txt
\immediate\write\out{Hello, World!}
\end
32 changes: 16 additions & 16 deletions archive/t/tex/testinfo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ folder:

container:
image: "rzuckerm/tex"
tag: "2019.20200218-1-1"
tag: "2025.01.25-1.17.0-2"
# sample program must write to a .txt file with same name -- e.g.,
# hello-world.tex writes to hello-world.txt
# args.txt contains the command line arguments
build: |
sh -c '(echo "#!/bin/sh"; \
echo "if [ \"\$#\" = 0 ];"; \
echo "then"; \
echo " touch args.txt"; \
echo "else"; \
echo " printf \"%s\\n\" \"\$@\" >args.txt"; \
echo "fi"; \
echo "if ! pdftex -halt-on-error -interaction=batchmode {{ source.name }}{{ source.extension }} >/dev/null"; \
echo "then"; \
echo " cat {{ source.name }}.log"; \
echo "else"; \
echo " pdf2html {{ source.name }}.pdf >{{ source.name }}.html && html2txt {{ source.name }}.html"; \
echo "fi" \
) >{{ source.name }}'
cmd: "sh ./{{ source.name }}"
bash -c ' \
if [ "$#" = 0 ]; \
then \
touch args.txt; \
else \
printf "%s\n" "$@" >args.txt; \
fi; \
if ! luatex -halt-on-error -interactionmode=batch {{ source.name }}{{ source.extension }}; \
then \
cat {{ source.name }}.log; \
exit 1; \
fi'
cmd: "cat {{ source.name }}.txt"

0 comments on commit 536d420

Please sign in to comment.