Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
90eb9aa
implemented slice function for stdlib_ascii
aman-godara May 23, 2021
e235bc4
added module dependencies of stdlib_math for function slice in Makefi…
aman-godara May 23, 2021
0742ca0
changed names from start to first and end to last
aman-godara May 24, 2021
1a5f78c
forgot to change the dummy argument start to first
aman-godara May 24, 2021
15827d2
shifted slice from stdlib_ascii to stdlib_strings and modified module…
aman-godara May 24, 2021
c7c1e48
removed include_last functionality
aman-godara May 25, 2021
ac607f1
added tests for slice function (with no include_last functionality)
aman-godara May 25, 2021
9d72c69
made complete use of slice interface: added test cases for character …
aman-godara May 25, 2021
a733bc3
documented function slice, corrected documentation of to_title and to…
aman-godara May 26, 2021
fa88905
improved function slice for invalid cases, added new invalid test cases
aman-godara May 27, 2021
42a905d
improved the implementation of last commit fa88905
aman-godara May 28, 2021
ffcb7e4
removed redundant outer loop, improved documentation of slice function
aman-godara May 29, 2021
4598eec
removed dependency of clip function by stdlib_strings.f90
aman-godara May 29, 2021
24d417f
improved documentation and comments for function slice
aman-godara Jun 7, 2021
323bcd9
Add general tester against intrinsic array slice
awvwgk Jun 10, 2021
a895085
Merge pull request #3 from awvwgk/slice
aman-godara Jun 10, 2021
d60dad3
added -inf and +inf concept to make code more intuitive, added descri…
aman-godara Jun 11, 2021
048b638
added the concept of +inf and -inf in documentation
aman-godara Jun 11, 2021
d38e0f4
added fail messages to unit tests
aman-godara Jun 11, 2021
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
Prev Previous commit
Next Next commit
added tests for slice function (with no include_last functionality)
  • Loading branch information
aman-godara committed May 25, 2021
commit ac607f1c1f551486ad657c2631e4484244fb375c
37 changes: 37 additions & 0 deletions src/tests/string/test_string_functions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module test_string_functions
use stdlib_error, only : check
use stdlib_string_type, only : string_type, assignment(=), operator(==), &
to_lower, to_upper, to_title, to_sentence, reverse
use stdlib_strings, only: slice
implicit none

contains
Expand Down Expand Up @@ -52,6 +53,41 @@ subroutine test_reverse_string

end subroutine test_reverse_string

subroutine test_slice_string
type(string_type) :: test_string
test_string = "abcdefghijklmnopqrstuvwxyz"

call check(slice(test_string, 2, 16, 3) == "behkn", &
'function slice failed', warn=.false.)
call check(slice(test_string, 15, stride=-1) == "onmlkjihgfedcba", &
'function slice failed', warn=.false.)
call check(slice(test_string, last=22, stride=-1) == "zyxwv", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, 2) == "gfedcb", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, 2, 1) == "", &
'function slice failed', warn=.false.)
call check(slice(test_string, 2, 6, -1) == "", &
'function slice failed', warn=.false.)
call check(slice(test_string, stride=-1) == "zyxwvutsrqponmlkjihgfedcba", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, 7, -4) == "g", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, 7, 3) == "g", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, 7, 3) == "g", &
'function slice failed', warn=.false.)
call check(slice(test_string, 7, -10) == "gfedcba", &
'function slice failed', warn=.false.)
call check(slice(test_string, 500, 22) == "zyxwv", &
'function slice failed', warn=.false.)

test_string = ""
call check(slice(test_string, 2, 16, 3) == "", &
'function slice failed', warn=.false.)

end subroutine test_slice_string

end module test_string_functions


Expand All @@ -64,5 +100,6 @@ program tester
call test_to_title_string
call test_to_sentence_string
call test_reverse_string
call test_slice_string

end program tester