Skip to content

Commit

Permalink
test(LongSubSeq): test lis on all Integer subtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
digital-carver committed Oct 25, 2023
1 parent c2b2a0e commit 5a3013d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/longest_increasing_subsequence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ using TheAlgorithms.LongSubSeq
# two possible results:
@test lis([3, 4, -1, 5, 8, 2, 3, 12, 7, 9, 10], Val(:dp)) in
[[-1, 2, 3, 7, 9, 10], [3, 4, 5, 8, 9, 10]]
# Boolean array
@test lis([true, false, false, true], Val(:dp)) == [false, true]
# other Integer subtypes
for T in [UInt128, UInt16, UInt32, UInt64, UInt8, BigInt, Int128, Int16, Int32, Int64, Int8]
@test lis(T[3, 10, 2, 1, 20], Val(:dp)) == T[3, 10, 20]
end
end

@testset "LIS: Binary Search approach!" begin
Expand All @@ -39,5 +45,11 @@ using TheAlgorithms.LongSubSeq
# two possible results:
@test lis([3, 4, -1, 5, 8, 2, 3, 12, 7, 9, 10], Val(:bs)) in
[[-1, 2, 3, 7, 9, 10], [3, 4, 5, 8, 9, 10]]
# Boolean array
@test lis([true, false, false, true], Val(:bs)) == [false, true]
# other Integer subtypes
for T in [UInt128, UInt16, UInt32, UInt64, UInt8, BigInt, Int128, Int16, Int32, Int64, Int8]
@test lis(T[3, 10, 2, 1, 20], Val(:bs)) == T[3, 10, 20]
end
end
end

0 comments on commit 5a3013d

Please sign in to comment.