Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alseïdon committed Jul 10, 2024
1 parent da25320 commit b8af28f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Results of C compilation
*.o
lib.so
lib.so


# Test artifacts
test/*/
23 changes: 23 additions & 0 deletions test/integration_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@testset "Integration tests" begin
#= DEFAULT MODELS =#
gen = TaylorGenerator("sincos", "sincos.eqs", ".")
generate_dir(gen)
han = get_handler(gen, true)

function flow(x, t, han)
y = similar(x)
ccall(han.symbols["flow"], Cint, (Cdouble, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}),
t, x, y, Ref(nothing)
)
return y
end

x = [1., 0.]
ts = LinRange(0., 2π, 101)
ys = map(t->flow(x, t, han), ts)
y1 = map(i->i[1], ys)
y2 = map(i->i[2], ys)

@test y1 cos.(ts)
@test y2 -sin.(ts)
end
2 changes: 2 additions & 0 deletions test/sincos.eqs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
diff(x, t) = y;
diff(y, t) = -x;

0 comments on commit b8af28f

Please sign in to comment.