The forgex_test_m module provides helper procedures to unit testing for Forgex.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | str | |||
| character(len=*), | intent(in) | :: | ret |
This function checks whether it returns the correct error for a given pattern and text.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | text | |||
| integer, | intent(in) | :: | expected_err_code | |||
| integer, | intent(inout) | :: | return_code |
This function checks if a pattern is found within a string and
compares the result to the correct_answer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| logical, | intent(in) | :: | correct_answer |
This function checks if a pattern matches exactly a string and compares the result to the correct answer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| logical, | intent(in) | :: | correct_answer |
This function checks if the given pattern is valid as a regex pattern
and compares the result to the correct_answer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| logical, | intent(in) | :: | correct_answer |
This function checks whether the correct prefix is extracted for a given pattern.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | expected_prefix | |||
| character(len=:), | allocatable | :: | resulting |
This function checks if a pattern matches a string using the regex
function and compares the result to the expected answer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| character(len=*), | intent(in) | :: | answer | |||
| character(len=:), | intent(inout), | allocatable | :: | substr |
This function checks whether the correct suffix is extracted for a given pattern.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | expected_suffix | |||
| character(len=:), | intent(inout), | allocatable | :: | resulting |
nchar means 'negative char'.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int8), | intent(in) | :: | i |
This function generates a string by repeating a given pattern a specified number of times.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | chara | |||
| integer, | intent(in) | :: | num |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | str |
This subroutine runs is_valid_error function and prints its result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | text | |||
| integer, | intent(in) | :: | code | |||
| logical, | intent(inout) | :: | result |
This subroutine runs the is_valid__in function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| logical, | intent(in) | :: | answer | |||
| logical, | intent(inout) | :: | result |
This subroutine runs the is_valid__match function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| logical, | intent(in) | :: | answer | |||
| logical, | intent(inout) | :: | result |
This subroutine runs the is_valid_prefix function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | prefix | |||
| logical, | intent(inout) | :: | result |
This subroutine runs the is_valid__regex function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | str | |||
| character(len=*), | intent(in) | :: | answer | |||
| logical, | intent(inout) | :: | result |
This function runs the is_valid_suffix function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| character(len=*), | intent(in) | :: | suffix | |||
| logical, | intent(inout) | :: | result |
This subroutine runs the is_valid__pattern function and prints the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | pattern | |||
| logical, | intent(in) | :: | answer | |||
| logical, | intent(inout) | :: | result |