Debian Codegraph @

src/tests/t.wordhist

raw
1 #! /bin/sh
2
3 # Note: When run via "make check", test output files are automatically deleted.
4 # When run from the command line, output files are left in directory
5 # wordhist.YYYYMMDD. This is useful when something is different.
6 #
7 # ./inputs - test inputs
8 # ./outputs - known correct outputs
9 #
10 # wordhist.YYYYMMDD:
11 # directory containing individual output files
12
13 NODB=1 . ${srcdir=.}/t.frame
14
15 [ -d "$TMPDIR"/tests ] && rm -rf "$TMPDIR"/tests
16 mkdir -p "$TMPDIR"/tests
17
18 OUT="$TMPDIR"/wordhist.out
19 REF="$TMPDIR/wordhist.ref"
20
21 cat <<EOF > "$REF"
22 Histogram
23 score count pct histogram
24 0.00 3515 66.30 ################################################
25 0.05 1 0.02 #
26 0.10 1 0.02 #
27 0.15 7 0.13 #
28 0.20 10 0.19 #
29 0.25 12 0.23 #
30 0.30 16 0.30 #
31 0.35 27 0.51 #
32 0.40 38 0.72 #
33 0.45 19 0.36 #
34 0.50 82 1.55 ##
35 0.55 10 0.19 #
36 0.60 29 0.55 #
37 0.65 135 2.55 ##
38 0.70 7 0.13 #
39 0.75 22 0.41 #
40 0.80 63 1.19 #
41 0.85 14 0.26 #
42 0.90 28 0.53 #
43 0.95 1266 23.88 ##################
44 tot 5302
45 hapaxes: ham 2593 (48.91%), spam 784 (14.79%)
46 pure: ham 3515 (66.30%), spam 1257 (23.71%)
47 EOF
48
49 OPTS="-C -y 0"
50
51 $BOGOFILTER $OPTS -s < "$SYSTEST/inputs/spam.mbx"
52 $BOGOFILTER $OPTS -n < "$SYSTEST/inputs/good.mbx"
53
54 $BOGOUTIL -C -H "$BOGOFILTER_DIR/wordlist.$DB_EXT" > "$OUT"
55 $BOGOUTIL -C -d "$BOGOFILTER_DIR/wordlist.$DB_EXT" > "$TMPDIR"/wordlist.txt
56
57 if [ $verbose -eq 0 ]; then
58 cmp "$REF" "$OUT"
59 else
60 diff $DIFF_BRIEF "$REF" "$OUT"
61 fi