summaryrefslogtreecommitdiffstats
path: root/tools/regression/usr.bin/ncal/regress.sh
blob: 3dc188db97a3d920510a5e233245f4a9b22b0ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# $FreeBSD$

CAL_BIN="ncal"
CAL="${CAL_BIN} -C"
NCAL="${CAL_BIN} -N"
YEARS="2008 2009 2010 2011"
ONEYEAR="2009"

REGRESSION_START($1)

#
# The first tests are layout tests, to make sure that the output is still the
# same despite varying months.
#

# Full year calendars

echo 1..16

for y in ${YEARS}; do
	# Regular calendar, Month days, No-highlight
	REGRESSION_TEST(`r-y${y}-md-nhl', `$NCAL -h ${y}')
	# Backwards calendar, Month days, No-highlight
	REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -h ${y}')
	# Regular calendar, Julian days, No-highlight
	REGRESSION_TEST(`r-y${y}-jd-nhl', `$NCAL -jh ${y}')
	# Backwards calendar, Julian days, No-highlight
	REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jh ${y}')
done

# 3 month calendars

echo 17 .. 29

for m in $(jot -w %02d 12); do
	# Regular calendar, Month days, No-highlight
	REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl',
	    `$NCAL -h3 ${m} ${ONEYEAR}')
	# Backwards calendar, Month days, No-highlight
	REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}')
	# Regular calendar, Julian days, No-highlight
	REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl',
	    `$NCAL -jh3 ${m} ${ONEYEAR}')
	# Backwards calendar, Julian days, No-highlight
	REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}')
done

#
# The next tests are combinations of the various arguments.
#

# These should fail
REGRESSION_TEST(`f-3y-nhl',  `$NCAL -3 -y 2>&1')
REGRESSION_TEST(`f-3A-nhl',  `$NCAL -3 -A 3 2>&1')
REGRESSION_TEST(`f-3B-nhl',  `$NCAL -3 -B 3 2>&1')
REGRESSION_TEST(`f-3gy-nhl', `$NCAL -3 2008 2>&1')
REGRESSION_TEST(`f-3AB-nhl', `$NCAL -3 -A 3 -B 3 2>&1')
REGRESSION_TEST(`f-mgm-nhl', `$NCAL -m 3 2 2008 2>&1')
REGRESSION_TEST(`f-ym-nhl',  `$NCAL -y -m 2 2>&1')
REGRESSION_TEST(`f-ygm-nhl', `$NCAL -y 2 2008 2>&1')
REGRESSION_TEST(`f-yA-nhl',  `$NCAL -y -A 3 2>&1')
REGRESSION_TEST(`f-yB-nhl',  `$NCAL -y -B 3 2>&1')
REGRESSION_TEST(`f-yAB-nhl', `$NCAL -y -A 3 -B 3 2>&1')

# These should be successful

REGRESSION_TEST(`s-b-3-nhl',    `$CAL -d 2008.03 -3')
REGRESSION_TEST(`s-b-A-nhl',    `$CAL -d 2008.03 -A 1')
REGRESSION_TEST(`s-b-B-nhl',    `$CAL -d 2008.03 -B 1')
REGRESSION_TEST(`s-b-AB-nhl',   `$CAL -d 2008.03 -A 1 -B 1')
REGRESSION_TEST(`s-b-m-nhl',    `$CAL -d 2008.03 -m 1')
REGRESSION_TEST(`s-b-mgy-nhl',  `$CAL -d 2008.03 -m 1 2007')
REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -d 2008.03 1 2007')
REGRESSION_TEST(`s-r-3-nhl',    `$NCAL -d 2008.03 -3')
REGRESSION_TEST(`s-r-A-nhl',    `$NCAL -d 2008.03 -A 1')
REGRESSION_TEST(`s-r-B-nhl',    `$NCAL -d 2008.03 -B 1')
REGRESSION_TEST(`s-r-AB-nhl',   `$NCAL -d 2008.03 -A 1 -B 1')
REGRESSION_TEST(`s-r-m-nhl',    `$NCAL -d 2008.03 -m 1')
REGRESSION_TEST(`s-r-mgy-nhl',  `$NCAL -d 2008.03 -m 1 2007')
REGRESSION_TEST(`s-r-gmgy-nhl', `$NCAL -d 2008.03 1 2007')

REGRESSION_END()
OpenPOWER on IntegriCloud