]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/ncal/tests/regress.sh
Merge llvm-project release/17.x llvmorg-17.0.3-0-g888437e1b600
[FreeBSD/FreeBSD.git] / usr.bin / ncal / tests / regress.sh
1
2 CAL_BIN="ncal"
3 CAL="${CAL_BIN} -C"
4 NCAL="${CAL_BIN} -N"
5 YEARS="2008 2009 2010 2011"
6 ONEYEAR="2009"
7
8 echo 1..89
9
10 REGRESSION_START($1)
11
12 #
13 # The first tests are layout tests, to make sure that the output is still the
14 # same despite varying months.
15 #
16
17 # Full year calendars
18
19 for y in ${YEARS}; do
20         # Regular calendar, Month days, No-highlight
21         REGRESSION_TEST(`r-y${y}-md-nhl', `$NCAL -h ${y}')
22         # Backwards calendar, Month days, No-highlight
23         REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -h ${y}')
24         # Regular calendar, Julian days, No-highlight
25         REGRESSION_TEST(`r-y${y}-jd-nhl', `$NCAL -jh ${y}')
26         # Backwards calendar, Julian days, No-highlight
27         REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jh ${y}')
28 done
29
30 # 3 month calendars
31
32 for m in $(jot -w %02d 12); do
33         # Regular calendar, Month days, No-highlight
34         REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl',
35             `$NCAL -h3 ${m} ${ONEYEAR}')
36         # Backwards calendar, Month days, No-highlight
37         REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}')
38         # Regular calendar, Julian days, No-highlight
39         REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl',
40             `$NCAL -jh3 ${m} ${ONEYEAR}')
41         # Backwards calendar, Julian days, No-highlight
42         REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}')
43 done
44
45 #
46 # The next tests are combinations of the various arguments.
47 #
48
49 # These should fail
50 REGRESSION_TEST(`f-3y-nhl',  `$NCAL -3 -y 2>&1')
51 REGRESSION_TEST(`f-3A-nhl',  `$NCAL -3 -A 3 2>&1')
52 REGRESSION_TEST(`f-3B-nhl',  `$NCAL -3 -B 3 2>&1')
53 REGRESSION_TEST(`f-3gy-nhl', `$NCAL -3 2008 2>&1')
54 REGRESSION_TEST(`f-3AB-nhl', `$NCAL -3 -A 3 -B 3 2>&1')
55 REGRESSION_TEST(`f-mgm-nhl', `$NCAL -m 3 2 2008 2>&1')
56 REGRESSION_TEST(`f-ym-nhl',  `$NCAL -y -m 2 2>&1')
57 REGRESSION_TEST(`f-ygm-nhl', `$NCAL -y 2 2008 2>&1')
58 REGRESSION_TEST(`f-yA-nhl',  `$NCAL -y -A 3 2>&1')
59 REGRESSION_TEST(`f-yB-nhl',  `$NCAL -y -B 3 2>&1')
60 REGRESSION_TEST(`f-yAB-nhl', `$NCAL -y -A 3 -B 3 2>&1')
61
62 # These should be successful
63
64 REGRESSION_TEST(`s-b-3-nhl',    `$CAL -d 2008.03 -3')
65 REGRESSION_TEST(`s-b-A-nhl',    `$CAL -d 2008.03 -A 1')
66 REGRESSION_TEST(`s-b-B-nhl',    `$CAL -d 2008.03 -B 1')
67 REGRESSION_TEST(`s-b-AB-nhl',   `$CAL -d 2008.03 -A 1 -B 1')
68 REGRESSION_TEST(`s-b-m-nhl',    `$CAL -d 2008.03 -m 1')
69 REGRESSION_TEST(`s-b-mgy-nhl',  `$CAL -d 2008.03 -m 1 2007')
70 REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -d 2008.03 1 2007')
71 REGRESSION_TEST(`s-r-3-nhl',    `$NCAL -d 2008.03 -3')
72 REGRESSION_TEST(`s-r-A-nhl',    `$NCAL -d 2008.03 -A 1')
73 REGRESSION_TEST(`s-r-B-nhl',    `$NCAL -d 2008.03 -B 1')
74 REGRESSION_TEST(`s-r-AB-nhl',   `$NCAL -d 2008.03 -A 1 -B 1')
75 REGRESSION_TEST(`s-r-m-nhl',    `$NCAL -d 2008.03 -m 1')
76 REGRESSION_TEST(`s-r-mgy-nhl',  `$NCAL -d 2008.03 -m 1 2007')
77 REGRESSION_TEST(`s-r-gmgy-nhl', `$NCAL -d 2008.03 1 2007')
78
79 REGRESSION_END()