21 lines
556 B
Julia
21 lines
556 B
Julia
|
using .ExpressionProcessing
|
||
|
using .Interpreter
|
||
|
|
||
|
expressions = Vector{Expr}(undef, 1)
|
||
|
variables = Matrix{Float64}(undef, 1,2)
|
||
|
parameters = Vector{Vector{Float64}}(undef, 1)
|
||
|
|
||
|
# Resulting value should be 10
|
||
|
expressions[1] = :(x1 + 1 * x2 + p1)
|
||
|
variables[1,1] = 2
|
||
|
variables[1,2] = 3
|
||
|
parameters[1] = Vector{Float64}(undef, 1)
|
||
|
parameters[1][1] = 5
|
||
|
|
||
|
@testset "Test interpretation" begin
|
||
|
postfixExpr = expr_to_postfix(expressions[1])
|
||
|
postfixExprs = Vector{PostfixType}(undef, 1)
|
||
|
postfixExprs[1] = postfixExpr
|
||
|
|
||
|
Interpret(postfixExprs, variables, parameters)
|
||
|
end
|