using .ExpressionProcessing 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 conversion expression element" begin reference1 = ExpressionElement(FLOAT64, reinterpret(Int64, 1.0)) reference2 = ExpressionElement(INDEX, reinterpret(Int64, 1)) reference3 = ExpressionElement(OPERATOR, reinterpret(Int64, ADD)) @test isequal(reference1, ExpressionProcessing.convert_to_ExpressionElement(1.0)) @test isequal(reference2, ExpressionProcessing.convert_to_ExpressionElement(1)) @test isequal(reference3, ExpressionProcessing.convert_to_ExpressionElement(ADD)) end @testset "Test conversion to postfix" begin reference = PostfixType() append!(reference, [ExpressionProcessing.convert_to_ExpressionElement(1), ExpressionProcessing.convert_to_ExpressionElement(1.0), ExpressionProcessing.convert_to_ExpressionElement(2), ExpressionProcessing.convert_to_ExpressionElement(MULTIPLY), ExpressionProcessing.convert_to_ExpressionElement(ADD), ExpressionProcessing.convert_to_ExpressionElement(-1), ExpressionProcessing.convert_to_ExpressionElement(ADD)]) postfix = expr_to_postfix(expressions[1]) @test isequal(reference, postfix) # TODO: Do more complex expressions because these have led to errors in the past end