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