Skip to content

Commit

Permalink
Add unit test for calcPhotolysisRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Cox committed Sep 5, 2018
1 parent 4c2d515 commit 4e2e16d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions travis/unit_tests/constraint_test.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module constraint_test
use fruit
use types_mod
implicit none

contains

subroutine test_calcPhotolysisRaw
use types_mod
use constraint_functions_mod, only : calcPhotolysisRaw
use zenith_data_mod, only : cosx, secx
implicit none

! photolysis = l * cosx ** m * exp( -n * secx ) * tf
cosx = 1.0_DP
secx = 1.0_DP / cosx
call assert_true(calcPhotolysisRaw( 1.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == exp( -1.0_DP ), "calcPhotolysisRaw all ones")
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == 2.0_DP * exp( -1.0_DP ), "calcPhotolysisRaw 2")

cosx = 0.5_DP
secx = 1.0_DP / cosx
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == exp( -2.0_DP ), "calcPhotolysisRaw 3")
call assert_true(calcPhotolysisRaw( 2.0_DP, 2.0_DP, 1.0_DP, 1.0_DP ) == 0.5_DP * exp( -2.0_DP ), "calcPhotolysisRaw 4")
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 2.0_DP, 1.0_DP ) == exp( -4.0_DP ), "calcPhotolysisRaw 5")
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 2.0_DP ) == 2.0_DP * exp( -2.0_DP ), "calcPhotolysisRaw 6")

end subroutine test_calcPhotolysisRaw

end module constraint_test

0 comments on commit 4e2e16d

Please sign in to comment.