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