| 1 |
#!/usr/bin/env bash |
| 2 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 3 |
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 4 |
# |
| 5 |
# This program 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 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program 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 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
#------------------------------------------------------------------------------- |
| 18 |
# basic cylc cyclepoint --template option tests |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
#------------------------------------------------------------------------------- |
| 21 |
set_test_number 12 |
| 22 |
#------------------------------------------------------------------------------- |
| 23 |
TEST_NAME=${TEST_NAME_BASE}-extract |
| 24 |
run_ok "${TEST_NAME}.strf" cylc cyclepoint --template foo-%Y-%m-%d-%H.nc 20140809T12 |
| 25 |
cmp_ok "${TEST_NAME}.strf.stdout" - << __OUT__ |
| 26 |
foo-2014-08-09-12.nc |
| 27 |
__OUT__ |
| 28 |
#------------------------------------------------------------------------------- |
| 29 |
run_ok "${TEST_NAME}.yr" cylc cyclepoint --template CCYY 20140808T1200 |
| 30 |
cmp_ok "${TEST_NAME}.yr.stdout" - << __OUT__ |
| 31 |
2014 |
| 32 |
__OUT__ |
| 33 |
#------------------------------------------------------------------------------- |
| 34 |
run_ok "${TEST_NAME}.month" cylc cyclepoint --template CC 20140809T1200 |
| 35 |
cmp_ok "${TEST_NAME}.month.stdout" - << __OUT__ |
| 36 |
20 |
| 37 |
__OUT__ |
| 38 |
#------------------------------------------------------------------------------- |
| 39 |
run_ok "${TEST_NAME}.month" cylc cyclepoint --template MM 20140809T1200 |
| 40 |
cmp_ok "${TEST_NAME}.month.stdout" - << __OUT__ |
| 41 |
08 |
| 42 |
__OUT__ |
| 43 |
#------------------------------------------------------------------------------- |
| 44 |
run_ok "${TEST_NAME}.day" cylc cyclepoint --template DD 20140809T1200 |
| 45 |
cmp_ok "${TEST_NAME}.day.stdout" - << __OUT__ |
| 46 |
09 |
| 47 |
__OUT__ |
| 48 |
#------------------------------------------------------------------------------- |
| 49 |
run_ok "${TEST_NAME}.hour" cylc cyclepoint --template hh 20140809T1200 |
| 50 |
cmp_ok "${TEST_NAME}.hour.stdout" - << __OUT__ |
| 51 |
12 |
| 52 |
__OUT__ |