MYMONTH="09 1752"
MYYEAR="1752"
-[ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
-ts_log ""
+function call_cal_simple {
+ ts_log "$1"
+ shift
+ if [ "$USETERM" == "yes" ]; then
+ $TS_CMD_CAL "$@"
+ fi
+ $TS_CMD_CAL "$@" >> $TS_OUTPUT
+}
+function call_cal {
+ local testname=$(echo "$2" | sed 's/-//g')
-ts_log "Gregorian - Monday-based month"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1m
-fi
-$TS_CMD_CAL -1m $MYMONTH >> $TS_OUTPUT
-ts_log "Gregorian - Sunday-based month"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1s $MYMONTH
-fi
-$TS_CMD_CAL -1s $MYMONTH >> $TS_OUTPUT
-ts_log "Julian - Monday-based month"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1mj $MYMONTH
-fi
-$TS_CMD_CAL -1mj $MYMONTH >> $TS_OUTPUT
-ts_log "Julian - Sunday-based month"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1sj $MYMONTH
-fi
-$TS_CMD_CAL -1sj $MYMONTH >> $TS_OUTPUT
+ if [ "$3" == "$MYYEAR" ]; then
+ testname="${testname}-year"
+ else
+ testname="${testname}-month"
+ fi
+ ts_init_subtest "$testname"
+ call_cal_simple "$@"
+ ts_finalize_subtest
+}
-ts_log "Gregorian - Monday-based three months"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -3m
-fi
-$TS_CMD_CAL -3m $MYMONTH >> $TS_OUTPUT
-ts_log "Gregorian - Sunday-based three months"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -3s $MYMONTH
-fi
-$TS_CMD_CAL -3s $MYMONTH >> $TS_OUTPUT
-ts_log "Julian - Monday-based three months"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -3mj $MYMONTH
-fi
-$TS_CMD_CAL -3mj $MYMONTH >> $TS_OUTPUT
-ts_log "Julian - Sunday-based three months"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -3sj $MYMONTH
-fi
-$TS_CMD_CAL -3sj $MYMONTH >> $TS_OUTPUT
+call_cal "Gregorian - Monday-based month with week numbers" -1mw $MYMONTH
+call_cal "Gregorian - Sunday-based month with week numbers" -1sw $MYMONTH
+call_cal "Julian - Monday-based month with week numbers" -1mjw $MYMONTH
+call_cal "Julian - Sunday-based month with week numbers" -1sjw $MYMONTH
+call_cal "Gregorian - Monday-based three months with week numbers" -3mw $MYMONTH
+call_cal "Gregorian - Sunday-based three months with week numbers" -3sw $MYMONTH
+call_cal "Julian - Monday-based three months with week numbers" -3mjw $MYMONTH
+call_cal "Julian - Sunday-based three months with week numbers" -3sjw $MYMONTH
+call_cal "Gregorian - Monday-based year with week numbers" -1mw $MYYEAR
+call_cal "Gregorian - Sunday-based year with week numbers" -1sw $MYYEAR
+call_cal "Julian - Monday-based year with week numbers" -1mjw $MYYEAR
+call_cal "Julian - Sunday-based year with week numbers" -1sjw $MYYEAR
-ts_log "Gregorian - Monday-based year"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1m $MYYEAR
-fi
-$TS_CMD_CAL -1m $MYYEAR >> $TS_OUTPUT
-ts_log "Gregorian - Sunday-based year"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1s $MYYEAR
-fi
-$TS_CMD_CAL -1s $MYYEAR >> $TS_OUTPUT
-ts_log "Julian - Monday-based year"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1mj $MYYEAR
-fi
-$TS_CMD_CAL -1mj $MYYEAR >> $TS_OUTPUT
-ts_log "Julian - Sunday-based year"
-if [ "$USETERM" == "yes" ]; then
- $TS_CMD_CAL -1sj $MYYEAR
-fi
-$TS_CMD_CAL -1sj $MYYEAR >> $TS_OUTPUT
+ts_init_subtest "week-iso"
+call_cal_simple "Gregorian - address by week number" --week=40 --iso $MYYEAR
+ts_finalize_subtest
+
+call_cal "Gregorian - Monday-based month" -1m $MYMONTH
+call_cal "Gregorian - Sunday-based month" -1s $MYMONTH
+call_cal "Julian - Monday-based month" -1mj $MYMONTH
+call_cal "Julian - Sunday-based month" -1sj $MYMONTH
+call_cal "Gregorian - Monday-based three months" -3m $MYMONTH
+call_cal "Gregorian - Sunday-based three months" -3s $MYMONTH
+call_cal "Julian - Monday-based three months" -3mj $MYMONTH
+call_cal "Julian - Sunday-based three months" -3sj $MYMONTH
+call_cal "Gregorian - Monday-based year" -1m $MYYEAR
+call_cal "Gregorian - Sunday-based year" -1s $MYYEAR
+call_cal "Julian - Monday-based year" -1mj $MYYEAR
+call_cal "Julian - Sunday-based year" -1sj $MYYEAR
ts_finalize