diff --git a/src/ops.jl b/src/ops.jl index e8ebcbac27f10d258d79bc02a894f0fc70e40c22..53a5044690349a42dbb7447255bfe838140b066b 100644 --- a/src/ops.jl +++ b/src/ops.jl @@ -74,7 +74,7 @@ end Return the reversal of A. """ -Base.reverse(A::AbstractFSA) = FSA(ω(A), T(A)', α(A), Ï(A), λ(A)) +Base.reverse(A::AbstractFSA) = FSA(ω(A), copy(T(A)'), α(A), Ï(A), λ(A)) """ renorm(A::FSA) diff --git a/test/runtests.jl b/test/runtests.jl index 2c909e2f836cc5e9518128e0a1fe352318f424d7..cd1e71171014f52360c46724eae477b9a423eacc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -90,6 +90,12 @@ end @test cs_cB2p.tval[2] == cs_B2p_n3.tval[2] @test cs_cB2.tval[1] ≈ cs_B2_n3.tval[1] @test cs_cB2.tval[2] == cs_B2_n3.tval[2] + + # reverse + rB2 = convert((w, l) -> f(L, w, l), A2 |> reverse) + s1 = val(cumsum(B2).tval[2]) + s2 = Set((StringMonoid ∘ reverse ∘ val).((val ∘ cumsum)(rB2)[2])) + @test s1 == s2 end end