Skip to content

Commit

Permalink
fixed a doctest in free_associative_algebra.md and added a simple tes…
Browse files Browse the repository at this point in the history
…t case for aho corasick automata
  • Loading branch information
julien-schanz committed Jul 3, 2023
1 parent e5d32be commit 9a29b09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions docs/src/free_associative_algebra.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ to the function, to only compute a partial Groebner basis.

```jldoctest; setup = :(using AbstractAlgebra)
julia> R, (x, y, u, v, t, s) = free_associative_algebra(GF(2), ["x", "y", "u", "v", "t", "s"])
(Free associative algebra over Finite field F_2 on x, y, u, v, t, s,
AbstractAlgebra.Generic.FreeAssAlgElem{AbstractAlgebra.GFElem{Int64}}[x, y, u, v, t, s])
(Free associative algebra on 6 indeterminates over finite field F_2, AbstractAlgebra.Generic.FreeAssAlgElem{AbstractAlgebra.GFElem{Int64}}[x, y, u, v, t, s])
julia> g = Generic.groebner_basis([u*(x*y)^3 + u*(x*y)^2 + u + v, (y*x)^3*t + (y*x)^2*t + t + s])
5-element Vector{AbstractAlgebra.Generic.FreeAssAlgElem{AbstractAlgebra.GFElem{Int64}}}:
Expand Down
5 changes: 3 additions & 2 deletions test/generic/AhoCorasick-test.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using AbstractAlgebra.Generic: AhoCorasickAutomaton, search, AhoCorasickMatch
using AbstractAlgebra.Generic: AhoCorasickAutomaton, search, AhoCorasickMatch, aho_corasick_automaton
@testset "Generic.AhoCorasick" begin
keywords = [[1, 2, 3, 4], [1, 5, 4], [4, 1, 2], [1, 2]]
aut = AhoCorasickAutomaton(keywords)
aut = aho_corasick_automaton(keywords)
@test search(aut, [10, 4, 1, 2, 3, 4]) == AhoCorasickMatch(6, 1, [1, 2, 3, 4])
@test hash(search(aut, [10, 4, 1, 2, 3, 4])) == hash(AhoCorasickMatch(6, 1, [1, 2, 3, 4]))
@test isnothing(search(aut, []))
@test search(aut, [1, 5, 4, 1, 1, 1, 4, 4]) == AhoCorasickMatch(3, 2, [1, 5, 4])
@test search(aut, [1, 2, 3, 1, 4, 1, 2, 1, 4, 1, 2]) == AhoCorasickMatch(7, 3, [4, 1, 2])
Expand Down

0 comments on commit 9a29b09

Please sign in to comment.