using .ExpressionProcessing

expressions = Vector{Expr}(undef, 2)

expressions[1] = :(x1 + 1 * x2 + p1)
expressions[2] = :(x[1] + 1 * x[2] + p[1])

@testset "Test conversion expression element" begin
	reference1 = ExpressionElement(FLOAT32, reinterpret(Int32, 1f0))
	reference2 = ExpressionElement(VARIABLE, Int32(1))
	reference3 = ExpressionElement(OPERATOR, reinterpret(Int32, ADD))
	
	@test isequal(reference1, ExpressionProcessing.convert_to_ExpressionElement(1.0))
	@test isequal(reference2, ExpressionProcessing.convert_to_ExpressionElement(:x1))
	@test isequal(reference3, ExpressionProcessing.convert_to_ExpressionElement(ADD))
end

@testset "Test conversion to postfix" begin
	reference = PostfixType()

	append!(reference, [ExpressionProcessing.convert_to_ExpressionElement(:x1), ExpressionProcessing.convert_to_ExpressionElement(1.0), ExpressionProcessing.convert_to_ExpressionElement(:x2), ExpressionProcessing.convert_to_ExpressionElement(MULTIPLY), 
	ExpressionProcessing.convert_to_ExpressionElement(ADD), ExpressionProcessing.convert_to_ExpressionElement(:p1), ExpressionProcessing.convert_to_ExpressionElement(ADD)])
	postfixVarsAsSymbol = expr_to_postfix(expressions[1], Dict{Expr, PostfixType}())
	postfixVarsAsArray = expr_to_postfix(expressions[2], Dict{Expr, PostfixType}())

	@test isequal(reference, postfixVarsAsSymbol)
	@test isequal(reference, postfixVarsAsArray)

	# TODO: Do more complex expressions because these have led to errors in the past
end