Skip to content

Commit

Permalink
[CWEB] Provide a comprehensive test for CTWILL.
Browse files Browse the repository at this point in the history
The material comes from https://github.com/ascherer/cwebtest and was
pre-processed with

$ ctwill ham ham # (twice), producing ham.{aux,idx,ref,scn,tex}
$ tex ham # producing ham.{dvi,log}
$ ctwill-refsort < ham.ref > ham.sref

plus for "proofing"

$ ctwill-proofsort ham.tex > ham-sorted.tex

Note that the fonal step is not active in ctwill.test.

git-svn-id: svn://tug.org/texlive/trunk/Build/source@67417 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
Andreas Scherer committed Jun 20, 2023
1 parent d772006 commit 9346d22
Show file tree
Hide file tree
Showing 16 changed files with 1,344 additions and 38 deletions.
2 changes: 2 additions & 0 deletions texk/web2c/cwebdir/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* ctwill-mini.ch,
* ctwill-w2c.ch,
* ctwill.bux: Use 'kpse_find_file' for '*.bux' files.
* ctwill.test,
* tests/: Comprehensive test of CTWILL and its utilities.

2023-06-18 Karl Berry <karl@freefriends.org>

Expand Down
52 changes: 14 additions & 38 deletions texk/web2c/cwebdir/ctwill.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,29 @@
# Copyright 2023 Andreas Scherer <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

testdir=$srcdir/cwebdir/tests

#
# (1) Test the "classic" CTWILL procedure
#
TEXMFCNF=$srcdir/../kpathsea \
CWEBINPUTS=$srcdir/cwebdir ./ctie -m ctwill.w \
cweave.w ctwill-w2c.ch ctwill-mini.ch || exit 1

# Prime the pump by running CTWILL twice
TEXMFCNF=$srcdir/../kpathsea \
CWEBINPUTS=$srcdir/cwebdir: ./ctwill +lpdf ctwill.w || exit 1

TEXMFCNF=$srcdir/../kpathsea \
CWEBINPUTS=$srcdir/cwebdir: ./ctwill +lpdf ctwill.w || exit 1

exit 0

# (can't) run TeX for the first time
#TEXMFCNF=$srcdir/../kpathsea \
# TEXINPUTS=$srcdir/cwebdir//: tex ctwill.tex || exit 1
CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1
CWEBINPUTS=$testdir ./ctwill +lpdf ham ham || exit 1

# Test CTWILL-REFSORT
TEXMFCNF=$srcdir/../kpathsea \
./ctwill-refsort < ctwill.ref > ctwill.sref || exit 1

# Run TeX for the second time -- NOT!
#TEXMFCNF=$srcdir/../kpathsea \
#TEXINPUTS=$srcdir/cwebdir//: tex ctwill.tex || exit 1
./ctwill-refsort < $testdir/ham.ref > ham.sref || exit 1
diff ham.sref $testdir/ham.sref || exit 1

#
# (2) Test the "proofing" CTWILL procedure
#
TEXMFCNF=$srcdir/../kpathsea \
CWEBINPUTS=$srcdir/cwebdir ./ctie -m ctwill.w \
cweave.w ctwill-w2c.ch ctwill-mini.ch \
ctwill-hint.ch || exit 1

# Running CTWILL once again, but with options +P +lpdf
TEXMFCNF=$srcdir/../kpathsea \
CWEBINPUTS=$srcdir/cwebdir: ./ctwill +P +lpdf ctwill.w || exit 1

# Test CTWILL-PROOFSORT
TEXMFCNF=$srcdir/../kpathsea \
$srcdir/cwebdir/ctwill-proofsort ctwill.tex > ctwill-sorted.tex || exit 1
#mv ctwill-sorted.tex ctwill.tex || exit 1 # -- NOT!

# Run pdfTeX once -- NOT!
#TEXMFCNF=$srcdir/../kpathsea \
#TEXINPUTS=$srcdir/cwebdir//: pdftex ctwill.tex || exit 1
CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1
CWEBINPUTS=$testdir ./ctwill +P +lpdf ham ham || exit 1

# Test CTWILL-PROOFSORT---NOT!
# First, it doesn't show up in Work/texk/web2c/ and
# second, Perl complains about the unresolved $Revision$ and §Date$.
#./ctwill-proofsort ham.tex > ham-sorted.tex || exit 1
#diff ham-sorted.tex $testdir/ham-sorted.tex || exit 1

exit 0
54 changes: 54 additions & 0 deletions texk/web2c/cwebdir/tests/gb_graph.hux
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@$util {GB\_\,GRAPH}8 =\&{union}@>
@$V {GB\_\,GRAPH}8 \&{Vertex} ${}{*}{}$@>
@$A {GB\_\,GRAPH}8 \&{Arc} ${}{*}{}$@>
@$G {GB\_\,GRAPH}8 \&{Graph} ${}{*}{}$@>
@$S {GB\_\,GRAPH}8 \&{char} ${}{*}{}$@>
@$I {GB\_\,GRAPH}8 \&{long}@>

@$Vertex {GB\_\,GRAPH}9 =\&{struct}@>
@$arcs {GB\_\,GRAPH}9 \&{Arc} ${}{*}{}$@>
@$name {GB\_\,GRAPH}9 \&{char} ${}{*}{}$@>
@$u {GB\_\,GRAPH}9 \&{util}@>
@$v {GB\_\,GRAPH}9 \&{util}@>
@$w {GB\_\,GRAPH}9 \&{util}@>
@$x {GB\_\,GRAPH}9 \&{util}@>
@$y {GB\_\,GRAPH}9 \&{util}@>
@$z {GB\_\,GRAPH}9 \&{util}@>

@$Arc {GB\_\,GRAPH}10 =\&{struct}@>
@$tip {GB\_\,GRAPH}10 \&{Vertex} ${}{*}{}$@>
@$next {GB\_\,GRAPH}10 \&{Arc} ${}{*}{}$@>
@$len {GB\_\,GRAPH}10 \&{long}@>
@$a {GB\_\,GRAPH}10 \&{util}@>
@$b {GB\_\,GRAPH}10 \&{util}@>

@$gb_typed_alloc {GB\_\,GRAPH}11 =macro (\,)@>

@$Graph {GB\_\,GRAPH}20 =\&{struct}@>
@$vertices {GB\_\,GRAPH}20 \&{Vertex} ${}{*}{}$@>
@$n {GB\_\,GRAPH}20 \&{long}@>
@$m {GB\_\,GRAPH}20 \&{long}@>
@$uu {GB\_\,GRAPH}20 \&{util}@>
@$vv {GB\_\,GRAPH}20 \&{util}@>
@$ww {GB\_\,GRAPH}20 \&{util}@>
@$xx {GB\_\,GRAPH}20 \&{util}@>
@$yy {GB\_\,GRAPH}20 \&{util}@>
@$zz {GB\_\,GRAPH}20 \&{util}@>

@$n_1 {GB\_\,GRAPH}22 =\\{uu}.\|I@>

@$arcs_per_block {GB\_\,GRAPH}29 =\T{102}@>

@$gb_new_graph {GB\_\,GRAPH}31 =macro@>
@$gb_new_arc {GB\_\,GRAPH}31 =macro@>
@$gb_new_edge {GB\_\,GRAPH}31 =macro@>

@$siz_t {GB\_\,GRAPH}34 =\&{unsigned} \&{long}@>

@$string_block_size {GB\_\,GRAPH}35 =\T{1016}@>

@$hash_link {GB\_\,GRAPH}43 =\|u.\|V@>
@$hash_head {GB\_\,GRAPH}43 =\|v.\|V@>

@$HASH_MULT {GB\_\,GRAPH}45 =\T{314159}@>
@$HASH_PRIME {GB\_\,GRAPH}45 =\T{516595003}@>
29 changes: 29 additions & 0 deletions texk/web2c/cwebdir/tests/gb_save.hux
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@$MAX_SV_STRING {GB\_\,SAVE}1 =\T{4095}@>
@$MAX_SV_ID {GB\_\,SAVE}1 =\T{154}@>

@$restore_graph {GB\_\,SAVE}4 \&{Graph} ${}{*}(\,){}$@>

@$panic {GB\_\,SAVE}5 =macro (\,)@>

@$fillin {GB\_\,SAVE}7 =macro (\,)@>

@$buffer {GB\_\,SAVE}13 =macro@>

@$bad_type_code {GB\_\,SAVE}19 =\T{\^1}@>
@$string_too_long {GB\_\,SAVE}19 =\T{\^2}@>
@$addr_not_in_data_area {GB\_\,SAVE}19 =\T{\^4}@>
@$addr_in_mixed_block {GB\_\,SAVE}19 =\T{\^8}@>
@$bad_string_char {GB\_\,SAVE}19 =\T{\^10}@>
@$ignored_data {GB\_\,SAVE}19 =\T{\^20}@>

@$unk {GB\_\,SAVE}21 =\T{0}@>
@$ark {GB\_\,SAVE}21 =\T{1}@>
@$vrt {GB\_\,SAVE}21 =\T{2}@>
@$mxt {GB\_\,SAVE}21 =\T{3}@>
@$block_rep {GB\_\,SAVE}21 =\&{struct}@>

@$lookup {GB\_\,SAVE}25 =macro (\,)@>

@$append_comma {GB\_\,SAVE}37 =macro@>

@$trans {GB\_\,SAVE}39 =macro (\,)@>
8 changes: 8 additions & 0 deletions texk/web2c/cwebdir/tests/gb_types.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@q This file makes CWEAVE treat Graph, Arc, Vertex, etc. as reserved words. @>

@s Graph int
@s Arc int
@s Vertex int
@s Area int
@s util int
@s siz_t int
Loading

0 comments on commit 9346d22

Please sign in to comment.