update
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using Test
|
||||
using GeneralUtils
|
||||
|
||||
@testset "lastElementsIndex" begin
|
||||
@test GeneralUtils.lastElementsIndex([1,2,3,4,5], 3) == 3:5
|
||||
@test GeneralUtils.lastElementsIndex([1,2,3], 5) == 1:3
|
||||
@test GeneralUtils.lastElementsIndex([1], 1) == 1:1
|
||||
@test GeneralUtils.lastElementsIndex(collect(1:10), 4) == 7:10
|
||||
@test GeneralUtils.lastElementsIndex(Float64[], 2) == 1:0
|
||||
@test GeneralUtils.lastElementsIndex([1,2,3], 0) == length([1,2,3])+1:length([1,2,3])
|
||||
@test GeneralUtils.lastElementsIndex(["a","b","c"], 2) == 2:3
|
||||
@testset "ealierElementsIndex" begin
|
||||
@test GeneralUtils.ealierElementsIndex([1,2,3,4,5], 2) == 1:3
|
||||
@test GeneralUtils.ealierElementsIndex([1,2,3], 0) == 1:3
|
||||
@test GeneralUtils.ealierElementsIndex([1], 1) == 1:0
|
||||
@test GeneralUtils.ealierElementsIndex([], 0) == 1:0
|
||||
@test GeneralUtils.ealierElementsIndex([1,2,3,4], 4) == 1:0
|
||||
@test GeneralUtils.ealierElementsIndex([1,2,3,4], 5) == 1:0
|
||||
@test GeneralUtils.ealierElementsIndex(collect(1:10), 3) == 1:7
|
||||
@test_throws ErrorException GeneralUtils.ealierElementsIndex([1,2,3], -1)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user