made it possible to send expression to gpu alongside the needed data
Some checks failed
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Has been cancelled
Some checks failed
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Has been cancelled
This commit is contained in:
@ -11,28 +11,21 @@ variables[1,2] = 3
|
||||
parameters[1] = Vector{Float64}(undef, 1)
|
||||
parameters[1][1] = 5
|
||||
|
||||
@testset "Test symtable construction" begin
|
||||
symtable = construct_symtable(expressions, variables, parameters)
|
||||
@test haskey(symtable, (expressions[1], :x1))
|
||||
@test haskey(symtable, (expressions[1], :x2))
|
||||
@test haskey(symtable, (expressions[1], :p1))
|
||||
|
||||
@test symtable[(expressions[1], :x1)] ≈ 2.0 atol=0.01
|
||||
@test symtable[(expressions[1], :x2)] ≈ 3.0 atol=0.01
|
||||
@test symtable[(expressions[1], :p1)] ≈ 5.0 atol=0.01
|
||||
end
|
||||
|
||||
@testset "Test variable replacement in expression" begin
|
||||
symtable = construct_symtable(expressions, variables, parameters)
|
||||
exprCopy = deepcopy(expressions[1])
|
||||
replace_variables!(exprCopy, symtable, expressions[1])
|
||||
|
||||
@test eval(exprCopy) == 10 # If it can be evaluated, it means all variables have been replaced, as there are no globally defined variables
|
||||
@testset "Test conversion expression element" begin
|
||||
reference1 = ExpressionElement(FLOAT64, reinterpret(Int64, 1.0))
|
||||
reference2 = ExpressionElement(INT64, 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, [:x1, 1.0, :x2, Multiply, Add, :p1, Add])
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user