Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for constraintFunctions.f90 #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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