added test for converting AST to postfix
Some checks are pending
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Waiting to run

This commit is contained in:
2024-07-12 15:27:13 +02:00
parent 26741adec7
commit 59b1d77ad6
2 changed files with 22 additions and 10 deletions

View File

@ -22,10 +22,16 @@ end
@testset "Test variable replacement in expression" begin
symtable = ExpressionExecutorCuda.ExpressionProcessing.construct_symtable(expressions, variables, parameters)
println(keys(symtable))
exprCopy = deepcopy(expressions[1])
ExpressionExecutorCuda.ExpressionProcessing.replace_variables!(exprCopy, symtable, expressions[1])
dump(exprCopy)
@test eval(exprCopy) == 10 # If it can be evaluated, it means all variables have been replaced, as there are no globally defined variables
end
@testset "Test conversion to postfix" begin
reference = Array{Union{Float64,String},1}()
append!(reference, ["x1", 1.0, "x2", "*", "+", "p1", "+"])
postfix = ExpressionExecutorCuda.ExpressionProcessing.expr_to_postfix(expressions[1])
@test isequal(reference, postfix)
end