forked from sourceryinstitute/julienne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into simplify-julienne_test_t
- Loading branch information
Showing
7 changed files
with
94 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.smod | ||
*.mod | ||
*.o | ||
a.out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/julienne/julienne_test_m.f90 → src/julienne/julienne_test_m.F90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,20 +33,33 @@ function results() result(test_results) | |
type(test_description_t), allocatable :: test_descriptions(:) | ||
#if HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY | ||
test_descriptions = [ & | ||
test_description_t(string_t("returning the value passed after a command-line flag"), check_flag_value), & | ||
test_description_t(string_t("returning an empty string when a flag value is missing"), handle_missing_flag_value), & | ||
test_description_t(string_t("detecting a present command-line argument"), check_command_line_argument) & | ||
test_description_t(string_t("flag_value() result is the value passed after a command-line flag"), check_flag_value) & | ||
,test_description_t(string_t("flag_value() result is an empty string if command-line flag value is missing"), check_flag_value_missing) & | ||
,test_description_t(string_t("flag_value() result is an empty string if command-line flag is missing"), check_flag_missing) & | ||
,test_description_t(string_t("argument_present() result is .false. if a command-line argument is missing"), check_argument_missing) & | ||
,test_description_t(string_t("argument_present() result is .true. if a command-line argument is present"), check_argument_present) & | ||
] | ||
#else | ||
! Work around missing Fortran 2008 feature: associating a procedure actual argument with a procedure pointer dummy argument: | ||
procedure(test_function_i), pointer :: check_flag_ptr, handle_missing_value_ptr, check_command_ptr | ||
check_flag_ptr => check_flag_value | ||
handle_missing_value_ptr => handle_missing_flag_value | ||
check_command_ptr => check_command_line_argument | ||
procedure(test_function_i), pointer :: & | ||
check_flag_value_ptr & | ||
,check_flag_value_missing_ptr & | ||
,check_flag_missing_ptr & | ||
,check_argument_missing_ptr & | ||
,check_argument_present_ptr | ||
|
||
check_flag_value_ptr => check_flag_value | ||
check_flag_value_missing_ptr => check_flag_value_missing | ||
check_flag_missing_ptr => check_flag_missing | ||
check_argument_missing_ptr => check_argument_missing | ||
check_argument_present_ptr => check_argument_present | ||
|
||
test_descriptions = [ & | ||
test_description_t(string_t("returning the value passed after a command-line flag"), check_flag_ptr), & | ||
test_description_t(string_t("returning an empty string when a flag value is missing"), handle_missing_value_ptr), & | ||
test_description_t(string_t("detecting a present command-line argument"), check_command_ptr) & | ||
test_description_t(string_t("flag_value() result is the value passed after a command-line flag"), check_flag_value_ptr) & | ||
,test_description_t(string_t("flag_value() result is an empty string if command-line flag value is missing"), check_flag_value_missing_ptr) & | ||
,test_description_t(string_t("flag_value() result is an empty string if command-line flag is missing"), check_flag_missing_ptr) & | ||
,test_description_t(string_t("argument_present() result is .false. if a command-line argument is missing"), check_argument_missing_ptr) & | ||
,test_description_t(string_t("argument_present() result is .true. if a command-line argument is present"), check_argument_present_ptr) & | ||
] | ||
#endif | ||
test_descriptions = pack(test_descriptions, & | ||
|
@@ -57,38 +70,32 @@ function results() result(test_results) | |
|
||
function check_flag_value() result(test_passes) | ||
logical test_passes | ||
integer exit_status, command_status | ||
character(len=132) command_message | ||
|
||
call execute_command_line( & | ||
command = "fpm run --example get-flag-value -- --input-file some_file_name", & | ||
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & | ||
) | ||
test_passes = exit_status == 0 | ||
type(command_line_t) command_line | ||
test_passes = command_line%flag_value("--test") == "command_line_t" | ||
end function | ||
|
||
function handle_missing_flag_value() result(test_passes) | ||
function check_flag_value_missing() result(test_passes) | ||
logical test_passes | ||
integer exit_status, command_status | ||
character(len=132) command_message | ||
type(command_line_t) command_line | ||
test_passes = command_line%flag_value("--type") == "" | ||
end function | ||
|
||
call execute_command_line( & | ||
command = "fpm run --example handle-missing-flag -- --empty-flag", & | ||
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & | ||
) | ||
test_passes = exit_status == 0 | ||
function check_flag_missing() result(test_passes) | ||
logical test_passes | ||
type(command_line_t) command_line | ||
test_passes = command_line%flag_value("[email protected]") == "" | ||
end function | ||
|
||
function check_command_line_argument() result(test_passes) | ||
function check_argument_missing() result(test_passes) | ||
logical test_passes | ||
integer exit_status, command_status | ||
character(len=132) command_message | ||
type(command_line_t) command_line | ||
test_passes = .not. command_line%argument_present(["M1ss1ng-argUment"]) | ||
end function | ||
|
||
call execute_command_line( & | ||
command = "fpm run --example check-command-line-argument -- --some-argument", & | ||
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message & | ||
) | ||
test_passes = exit_status == 0 | ||
function check_argument_present() result(test_passes) | ||
logical test_passes | ||
type(command_line_t) command_line | ||
test_passes = command_line%argument_present(["--type"]) | ||
end function | ||
|
||
end module command_line_test_m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters