summaryrefslogtreecommitdiffstats
path: root/test
blob: 2ae88b58904b951605c8a0c38bd35900556d345e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/sh

# Check boundary conditions with small files. Output should match input.
for f in empty a ab abc abcd; do
	./markov <tests/$f > out
	if !(diff tests/$f out > /dev/null); then
		echo tests/$f: output of markov does not match input:
		diff tests/$f out
		exit 1
	fi
done
rm out

# Check that all words, pairs, and triples in output are in original.
orig=tests/psalms
./markov <$orig > out
awk -f tests/match.awk $orig out
rm out

# Check that the output has a similar ratio of c's and d's to test randomness of
# suffix selection.
./markov <tests/stats | freq -c | awk -f tests/stats.awk