[Dart-dev] [10366] DART/trunk/time_manager/tests: updates to the time tests - add a work directory with

nancy at ucar.edu nancy at ucar.edu
Mon Jun 13 16:16:57 MDT 2016


Revision: 10366
Author:   nancy
Date:     2016-06-13 16:16:57 -0600 (Mon, 13 Jun 2016)
Log Message:
-----------
updates to the time tests - add a work directory with
mkmf and pathnames files plus a quickbuild script.

Modified Paths:
--------------
    DART/trunk/time_manager/tests/timetest.f90

Added Paths:
-----------
    DART/trunk/time_manager/tests/advance_test.f90
    DART/trunk/time_manager/tests/work/

Removed Paths:
-------------
    DART/trunk/time_manager/tests/Makefile
    DART/trunk/time_manager/tests/input.nml

-------------- next part --------------
Deleted: DART/trunk/time_manager/tests/Makefile
===================================================================
--- DART/trunk/time_manager/tests/Makefile	2016-06-13 22:13:17 UTC (rev 10365)
+++ DART/trunk/time_manager/tests/Makefile	2016-06-13 22:16:57 UTC (rev 10366)
@@ -1,46 +0,0 @@
-# DART software - Copyright 2004 - 2013 UCAR. This open source software is
-# provided by UCAR, "as is", without charge, subject to all terms of use at
-# http://www.image.ucar.edu/DAReS/DART/DART_download
-#
-# DART $Id$
-
-# get the flag settings from the mkmf template directly
-
-include ../../mkmf/mkmf.template
-
-OBJS = types_mod.o utilities_mod.o time_manager_mod.o null_mpi_utilities_mod.o
-MODS = types_mod.mod utilities_mod.mod time_manager_mod.mod mpi_utilities_mod.mod
-EXES = timetest
-LOGS = dart_log.out dart_log.nml
-
-all: $(EXES)
-
-check: $(EXES)
-	./timetest
-
-clean:
-	rm -fr $(OBJS) $(MODS) $(EXES) timetest.o $(LOGS)
-
-timetest: $(OBJS) timetest.o
-	$(FC) -o timetest timetest.o $(OBJS) $(LDFLAGS)
-
-types_mod.o: ../../common/types_mod.f90
-	$(FC) -c ../../common/types_mod.f90 $(FFLAGS)
-
-null_mpi_utilities_mod.o: ../../mpi_utilities/null_mpi_utilities_mod.f90 types_mod.o
-	$(FC) -c ../../mpi_utilities/null_mpi_utilities_mod.f90 $(FFLAGS)
-
-utilities_mod.o: ../../utilities/utilities_mod.f90 types_mod.o
-	$(FC) -c ../../utilities/utilities_mod.f90 $(FFLAGS)
-
-time_manager_mod.o: ../time_manager_mod.f90 utilities_mod.o types_mod.o
-	$(FC) -c ../time_manager_mod.f90 $(FFLAGS)
-
-timetest.o: timetest.f90 time_manager_mod.o
-	$(FC) -c timetest.f90 $(FFLAGS)
-
-# <next few lines under version control, do not edit>
-# $URL$
-# $Revision$
-# $Date$
-

Copied: DART/trunk/time_manager/tests/advance_test.f90 (from rev 10364, DART/branches/trunk_sort_and_time/time_manager/tests/advance_test.f90)
===================================================================
--- DART/trunk/time_manager/tests/advance_test.f90	                        (rev 0)
+++ DART/trunk/time_manager/tests/advance_test.f90	2016-06-13 22:16:57 UTC (rev 10366)
@@ -0,0 +1,93 @@
+! DART software - Copyright 2004 - 2013 UCAR. This open source software is
+! provided by UCAR, "as is", without charge, subject to all terms of use at
+! http://www.image.ucar.edu/DAReS/DART/DART_download
+!
+! $Id$
+
+!> initial stab at test code for the advance_time utility
+
+program advance_test
+
+use     utilities_mod, only : error_handler, E_ERR, E_MSG,  &
+                              open_file, close_file
+use mpi_utilities_mod, only : shell_execute
+
+! the first argument is the input string to advance_time
+! the second argument is what we expect the output to be
+
+! start of code:
+
+call doit("20150505 0", "2015050500")
+
+call doit("20150505 0 -g", "  151334       0")
+
+call doit("20150505 1d -c", "2015-05-06-00000")
+call doit("20150505 0 -c", "2015-05-05-00000")
+call doit("20150505 -1d -c", "2015-05-04-00000")
+
+call doit("20150505 0 -w",    "2015-05-05_00:00:00")
+call doit("20150505 1s -w",   "2015-05-05_00:00:01")
+call doit("20150505 1d -w",   "2015-05-06_00:00:00")
+call doit("20150505 -1d -w",  "2015-05-04_00:00:00")
+call doit("20150505 -12h -w", "2015-05-04_12:00:00")
+
+call doit("20150505 1s", "20150505000001")
+call doit("20150505 1", "2015050501")
+call doit("20151231 1d", "2016010100")
+
+call doit("2015-05-05-00000 0",   "2015050500")
+call doit("2015-05-05-00000 1",   "2015050501")
+call doit("2015-05-05-00000 1m",  "201505050001")
+call doit("2015-05-05-00000 1s",  "20150505000001")
+
+call doit("2015-05-05-00000 0 -c",   "2015-05-05-00000")
+call doit("2015-05-05-00000 1 -c",   "2015-05-05-03600")
+call doit("2015-05-05-00000 1m -c",  "2015-05-05-00060")
+call doit("2015-05-05-00000 1s -c",  "2015-05-05-00001")
+
+!call doit("20150505 0", "2015050500")
+!call doit("20150505 0", "2015050500")
+
+contains
+
+subroutine doit(instr, expected)
+
+character(len=*), intent(in) :: instr
+character(len=*), intent(in) :: expected
+
+character(len=128) :: resultstr
+character(len=144) :: outmsg
+character(len=48) :: outbits(3)
+character(len=6) :: label
+integer :: retcode, iunit
+
+retcode = shell_execute("echo "//trim(instr)//" | ./advance_time > results")
+
+iunit = open_file("results")
+read(iunit, '(a)') resultstr
+call close_file(iunit)
+
+
+if (resultstr /= expected) then
+   !> @FIXME: do we make this stop?
+   label = "FAIL: "
+else
+   label = "PASS: "
+endif
+
+write(outbits(1), '(A)') 'instr:    '//trim(instr)
+write(outbits(2), '(A)') 'expected: '//trim(expected)
+write(outbits(3), '(A)') 'got:      '//trim(resultstr)
+
+write(outmsg, '(3A48)') adjustl(outbits(1)), adjustl(outbits(2)), adjustl(outbits(3))
+call error_handler(E_MSG, label, trim(outmsg))
+
+end subroutine doit
+
+end program
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$

Deleted: DART/trunk/time_manager/tests/input.nml
===================================================================
--- DART/trunk/time_manager/tests/input.nml	2016-06-13 22:13:17 UTC (rev 10365)
+++ DART/trunk/time_manager/tests/input.nml	2016-06-13 22:16:57 UTC (rev 10366)
@@ -1,3 +0,0 @@
-&utilities_nml
-   module_details = .false.
-   /

Modified: DART/trunk/time_manager/tests/timetest.f90
===================================================================
--- DART/trunk/time_manager/tests/timetest.f90	2016-06-13 22:13:17 UTC (rev 10365)
+++ DART/trunk/time_manager/tests/timetest.f90	2016-06-13 22:16:57 UTC (rev 10366)
@@ -4,6 +4,9 @@
 !
 ! $Id$
 
+!> @FIXME: this needs to be automated so the results can
+!> be checked and print pass/fail from inside the program.
+
 program timetest
 
 use time_manager_mod, only : set_calendar_type, GREGORIAN, time_type, &
@@ -17,7 +20,7 @@
 call set_calendar_type(GREGORIAN)
 
 print *, ' '
-print * ,' testing gregorian calendar 1980 to 1910'
+print * ,' testing gregorian calendar 1890 to 1910'
 do i = 1890, 1910
 
  mytime = set_date(i, 1, 1, 0, 0, 0)
@@ -30,8 +33,8 @@
 enddo
 
 print *, ' '
-print * ,' testing gregorian calendar 1990 to 2010'
-do i = 1990, 2010
+print * ,' testing gregorian calendar 1990 to 2016'
+do i = 1990, 2016
 
  mytime = set_date(i, 1, 1, 0, 0, 0)
  if (leap_year(mytime)) then


More information about the Dart-dev mailing list