test/: Add a couple of tests for recurrent items
This adds tests for following features/scenarios: * Recurrent appointments and events of all (repetition) types. * Recurrent appointments with a duration of more than 24 hours. * Overlapping recurrent appointments. * Recurrent items and leap years. * Recurrent items with an end date. * Recurrent items with exceptions. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
4e28e8a9cc
commit
0715a4433c
@ -16,7 +16,12 @@ TESTS = \
|
|||||||
appointment-001.sh \
|
appointment-001.sh \
|
||||||
next-001.sh \
|
next-001.sh \
|
||||||
search-001.sh \
|
search-001.sh \
|
||||||
bug-002.sh
|
bug-002.sh \
|
||||||
|
recur-001.sh \
|
||||||
|
recur-002.sh \
|
||||||
|
recur-003.sh \
|
||||||
|
recur-004.sh \
|
||||||
|
recur-005.sh
|
||||||
|
|
||||||
TESTS_ENVIRONMENT = \
|
TESTS_ENVIRONMENT = \
|
||||||
CALCURSE='$(top_builddir)/src/calcurse' \
|
CALCURSE='$(top_builddir)/src/calcurse' \
|
||||||
|
12
test/data/apts-recur
Normal file
12
test/data/apts-recur
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
01/01/2000 [1] {1D} Each day since 2000-01-01
|
||||||
|
01/01/2000 [1] {1W} Each Saturday since 2000-01-01
|
||||||
|
01/01/2000 [1] {1M} Each first day of the month since 2000-01-01
|
||||||
|
01/01/2000 [1] {1Y} Every year on January, 1st since year 2000
|
||||||
|
01/01/2000 [1] {2D} Every second day since 2000-01-01
|
||||||
|
01/01/2000 [1] {4W} Every 28 days since 2000-01-01
|
||||||
|
01/01/2000 [1] {7D} Same as "01/01/2000 [1] {1W}"
|
||||||
|
01/01/2000 [1] {3D -> 12/31/2000} Every three days in year 2000
|
||||||
|
01/01/2000 [1] {3D !01/04/2000} Every three days, but not on 2000-01-04
|
||||||
|
01/01/2000 @ 16:00 -> 01/02/2000 @ 02:00 {2D} |Recurrent appointment
|
||||||
|
01/01/2000 @ 00:00 -> 01/07/2000 @ 00:00 {1W} |Another recurrent appointment
|
||||||
|
01/01/2000 @ 00:00 -> 01/07/2000 @ 00:00 {1D} |Third recurrent appointment
|
50
test/recur-001.sh
Executable file
50
test/recur-001.sh
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \
|
||||||
|
-s01/01/2000 -r8 --format-recur-apt=''
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
01/01/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Each Saturday since 2000-01-01
|
||||||
|
* Each first day of the month since 2000-01-01
|
||||||
|
* Every year on January, 1st since year 2000
|
||||||
|
* Every second day since 2000-01-01
|
||||||
|
* Every 28 days since 2000-01-01
|
||||||
|
* Same as "01/01/2000 [1] {1W}"
|
||||||
|
* Every three days in year 2000
|
||||||
|
* Every three days, but not on 2000-01-04
|
||||||
|
|
||||||
|
01/02/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
|
||||||
|
01/03/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Every second day since 2000-01-01
|
||||||
|
|
||||||
|
01/04/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Every three days in year 2000
|
||||||
|
|
||||||
|
01/05/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Every second day since 2000-01-01
|
||||||
|
|
||||||
|
01/06/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
|
||||||
|
01/07/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Every second day since 2000-01-01
|
||||||
|
* Every three days in year 2000
|
||||||
|
* Every three days, but not on 2000-01-04
|
||||||
|
|
||||||
|
01/08/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Each Saturday since 2000-01-01
|
||||||
|
* Same as "01/01/2000 [1] {1W}"
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
14
test/recur-002.sh
Executable file
14
test/recur-002.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \
|
||||||
|
-d02/01/2000 --format-recur-apt=''
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
02/01/00:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Each first day of the month since 2000-01-01
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
17
test/recur-003.sh
Executable file
17
test/recur-003.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \
|
||||||
|
-d01/01/2001 --format-recur-apt=''
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
01/01/01:
|
||||||
|
* Each day since 2000-01-01
|
||||||
|
* Each first day of the month since 2000-01-01
|
||||||
|
* Every year on January, 1st since year 2000
|
||||||
|
* Every second day since 2000-01-01
|
||||||
|
* Every three days, but not on 2000-01-04
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
18
test/recur-004.sh
Executable file
18
test/recur-004.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \
|
||||||
|
-d01/01/2000 --format-recur-event=''
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
01/01/00:
|
||||||
|
- 00:00 -> ..:..
|
||||||
|
Another recurrent appointment
|
||||||
|
- 00:00 -> ..:..
|
||||||
|
Third recurrent appointment
|
||||||
|
- 16:00 -> ..:..
|
||||||
|
Recurrent appointment
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
18
test/recur-005.sh
Executable file
18
test/recur-005.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" = 'actual' ]; then
|
||||||
|
"$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \
|
||||||
|
-d01/10/2000 --format-recur-event=''
|
||||||
|
elif [ "$1" = 'expected' ]; then
|
||||||
|
cat <<EOD
|
||||||
|
01/10/00:
|
||||||
|
- ..:.. -> ..:..
|
||||||
|
Another recurrent appointment
|
||||||
|
- ..:.. -> 02:00
|
||||||
|
Recurrent appointment
|
||||||
|
- 00:00 -> ..:..
|
||||||
|
Third recurrent appointment
|
||||||
|
EOD
|
||||||
|
else
|
||||||
|
./run-test "$0"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user