Debian Codegraph @

tests/ts/cal/bigyear

raw
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="Year 2147483646"
17
18 . "$TS_TOPDIR"/functions.sh
19 ts_init "$*"
20
21 ts_check_test_command "$TS_HELPER_CAL"
22
23 export TERM=linux
24
25 USETERM=$( ts_has_option "useterm" "$*" )
26 MYMONTH="12 2147483646"
27 MYYEAR="2147483646"
28
29
30 CAL_TEST_TIME=1516562739 # 21st January 2018
31 export CAL_TEST_TIME
32
33 function call_cal {
34 local testname=$(echo "$2" | sed 's/-//g')
35
36 if [ "$3" == "$MYYEAR" ]; then
37 testname="${testname}-year"
38 else
39 testname="${testname}-month"
40 fi
41
42 ts_init_subtest "$testname"
43 ts_log "$1"
44 shift
45 if [ "$USETERM" == "yes" ]; then
46 $TS_HELPER_CAL "$@"
47 fi
48 $TS_HELPER_CAL "$@" >> $TS_OUTPUT
49 ts_finalize_subtest
50 }
51
52 call_cal "Gregorian - Monday-based month" -1m $MYMONTH
53 call_cal "Gregorian - Sunday-based month" -1s $MYMONTH
54 call_cal "Julian - Monday-based month" -1mj $MYMONTH
55 call_cal "Julian - Sunday-based month" -1sj $MYMONTH
56
57 call_cal "Gregorian - Monday-based 3 months" -3m $MYMONTH
58 call_cal "Gregorian - Sunday-based 3 months" -3s $MYMONTH
59 call_cal "Julian - Monday-based 3 months" -3mj $MYMONTH
60 call_cal "Julian - Sunday-based 3 months" -3sj $MYMONTH
61
62 call_cal "Gregorian - Monday-based year" -1m $MYYEAR
63 call_cal "Gregorian - Sunday-based year" -1s $MYYEAR
64 call_cal "Julian - Monday-based year" -1mj $MYYEAR
65 call_cal "Julian - Sunday-based year" -1sj $MYYEAR
66
67
68 call_cal "Gregorian - Monday-based month with weeks" -1mw $MYMONTH
69 call_cal "Gregorian - Sunday-based month with weeks" -1sw $MYMONTH
70 call_cal "Julian - Monday-based month with weeks" -1mjw $MYMONTH
71 call_cal "Julian - Sunday-based month with weeks" -1sjw $MYMONTH
72
73 call_cal "Gregorian - Monday-based 3 months with weeks" -3mw $MYMONTH
74 call_cal "Gregorian - Sunday-based 3 months with weeks" -3sw $MYMONTH
75 call_cal "Julian - Monday-based 3 months with weeks" -3mjw $MYMONTH
76 call_cal "Julian - Sunday-based 3 months with weeks" -3sjw $MYMONTH
77
78 call_cal "Gregorian - Monday-based year with weeks" -1mw $MYYEAR
79 call_cal "Gregorian - Sunday-based year with weeks" -1sw $MYYEAR
80 call_cal "Julian - Monday-based year with weeks" -1mjw $MYYEAR
81 call_cal "Julian - Sunday-based year with weeks" -1sjw $MYYEAR
82
83 ts_finalize