Skip to content

Commit

Permalink
Test split_string
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jun 19, 2023
1 parent 8ef0a46 commit 9f78093
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test_print.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Test
using SymbolicRegression
using SymbolicRegression.UtilsModule: split_string

include("test_params.jl")

Expand Down Expand Up @@ -45,3 +46,12 @@ for binop in [safe_pow, ^]
minitree = Node(5, Node("x1"), Node("x2"))
@test string_tree(minitree, opts) == "(x1 ^ x2)"
end

@testset "Test splitting of strings" begin
split_string("abcdefgh", 3) == ["abc", "def", "gh"]
split_string("abcdefgh", 100) == ["abcdefgh"]
split_string("", 1) == [""]
split_string("⋅⋅", 1) == ["", ""]
split_string("⋅⋅⋅⋅", 2) == ["⋅⋅", "⋅⋅"]
split_string("ραβγ", 2) == ["ρα", "βγ"]
end

0 comments on commit 9f78093

Please sign in to comment.