next up previous
Next: Design By Contract / Up: Unit Testing / Levelized Previous: Preliminary Levelized Design for

Unit Testing Implementation

Example:

     module Template_Class
     
       ! Module data and routines.
     
     end module Template_Class
     
     ifdef([UNITTEST],[
     
     program Unittest
     
       ! Testing code.
     
     end

     
     ])

Example:

! To test this module,
!
! Begin_Self_Test
!   % echo "Preprocessing unit test on Template..."
!   % m4 -P -I../include ../constants/numbers.F90 >  unittest.f90
!   % m4 -P -I../include   ../constants/flags.F90 » unittest.f90
!   % m4 -P -I../include      ../debug/verify.F90 » unittest.f90
!   % m4 -P -I../include              logical.F90 » unittest.f90
!   % m4 -P -DUNITTEST -I../include  template.F90 » unittest.f90
!   % echo "Compiling unit test on Template..."
!   % f90 unittest.f90 -w -o unittest
!   % echo "Running unit test on Template..."
!   % unittest > battery/template.test.new 2>&1
!   % rm -f unittest*
!   % echo "Diffing Template results with saved version..."
!   % diffnewold battery/template.test.new battery/template.test
! End_Self_Test


next up previous
Next: Design By Contract / Up: Unit Testing / Levelized Previous: Preliminary Levelized Design for
Michael L. Hall