]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/cal/sep1752w
tests: use subtests for sep1752w test
[thirdparty/util-linux.git] / tests / ts / cal / sep1752w
1 #!/bin/bash
2
3 # This file is part of util-linux.
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 TS_TOPDIR="${0%/*}/../.."
16 TS_DESC="September 1752 with week numbers"
17
18 . $TS_TOPDIR/functions.sh
19 ts_init "$*"
20
21 ts_check_test_command "$TS_CMD_CAL"
22
23 export TERM=linux
24
25 USETERM=$( ts_has_option "useterm" "$*" )
26 MYMONTH="09 1752"
27 MYYEAR="1752"
28
29 function call_cal_simple {
30 ts_log "$1"
31 shift
32 if [ "$USETERM" == "yes" ]; then
33 $TS_CMD_CAL "$@"
34 fi
35 $TS_CMD_CAL "$@" >> $TS_OUTPUT
36 }
37
38 function call_cal {
39 local testname=$(echo "$2" | sed 's/-//g')
40
41 if [ "$3" == "$MYYEAR" ]; then
42 testname="${testname}-year"
43 else
44 testname="${testname}-month"
45 fi
46
47 ts_init_subtest "$testname"
48 call_cal_simple "$@"
49 ts_finalize_subtest
50 }
51
52
53 call_cal "Gregorian - Monday-based month with week numbers" -1mw $MYMONTH
54
55 call_cal "Gregorian - Sunday-based month with week numbers" -1sw $MYMONTH
56
57 call_cal "Julian - Monday-based month with week numbers" -1mjw $MYMONTH
58
59 call_cal "Julian - Sunday-based month with week numbers" -1sjw $MYMONTH
60
61 call_cal "Gregorian - Monday-based three months with week numbers" -3mw $MYMONTH
62
63 call_cal "Gregorian - Sunday-based three months with week numbers" -3sw $MYMONTH
64
65 call_cal "Julian - Monday-based three months with week numbers" -3mjw $MYMONTH
66
67 call_cal "Julian - Sunday-based three months with week numbers" -3sjw $MYMONTH
68
69 call_cal "Gregorian - Monday-based year with week numbers" -1mw $MYYEAR
70
71 call_cal "Gregorian - Sunday-based year with week numbers" -1sw $MYYEAR
72
73 call_cal "Julian - Monday-based year with week numbers" -1mjw $MYYEAR
74
75 call_cal "Julian - Sunday-based year with week numbers" -1sjw $MYYEAR
76
77 ts_init_subtest "week-iso"
78 call_cal_simple "Gregorian - address by week number" --week=40 --iso $MYYEAR
79 ts_finalize_subtest
80
81 ts_finalize