forgex_test_m Module

The forgex_test_m module provides helper procedures to unit testing for Forgex.



Functions

public function is_valid__in(pattern, str, correct_answer) result(res)

This function checks if a pattern is found within a string and compares the result to the correct_answer.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
logical, intent(in) :: correct_answer

Return Value logical

public function is_valid__match(pattern, str, correct_answer) result(res)

This function checks if a pattern matches exactly a string and compares the result to the correct answer.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
logical, intent(in) :: correct_answer

Return Value logical

public function is_valid__prefix(pattern, expected_prefix) result(res)

This function checks whether the correct prefix is extracted for a given pattern.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: expected_prefix

Return Value logical

public function is_valid__regex(pattern, str, answer, substr) result(res)

This function checks if a pattern matches a string using the regex function and compares the result to the expected answer.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
character(len=*), intent(in) :: answer
character(len=:), intent(inout), allocatable :: substr

Return Value logical

public function is_valid__suffix(pattern, expected_suffix) result(res)

This function checks whether the correct suffix is extracted for a given pattern.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: expected_suffix

Return Value logical


Subroutines

public subroutine runner_in(pattern, str, answer, result)

This subroutine runs the is_valid__in function and prints the result.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
logical, intent(in) :: answer
logical, intent(inout) :: result

public subroutine runner_match(pattern, str, answer, result)

This subroutine runs the is_valid__match function and prints the result.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
logical, intent(in) :: answer
logical, intent(inout) :: result

public subroutine runner_prefix(pattern, prefix, result)

This subroutine runs the is_valid_prefix function and prints the result.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: prefix
logical, intent(inout) :: result

public subroutine runner_regex(pattern, str, answer, result)

This subroutine runs the is_valid__regex function and prints the result.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: str
character(len=*), intent(in) :: answer
logical, intent(inout) :: result

public subroutine runner_suffix(pattern, suffix, result)

This function runs the is_valid_suffix function and prints the result.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: suffix
logical, intent(inout) :: result