Skip to content

Commit ee5480f

Browse files
improved coverage (#46)
1 parent d4039ed commit ee5480f

File tree

6 files changed

+23
-98
lines changed

6 files changed

+23
-98
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CTDirect"
22
uuid = "790bbbee-bee9-49ee-8912-a9de031322d5"
33
authors = ["Olivier Cots <olivier.cots@enseeiht.fr>"]
4-
version = "0.3.1"
4+
version = "0.3.2"
55

66
[deps]
77
ADNLPModels = "54578032-b7ea-4c30-94aa-7cbd1cce6c9a"

src/CTDirect.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ include("solve.jl")
2020

2121
# export functions only for user
2222
export solve
23+
export is_solvable
2324

2425
end

test/suite/double_integrator.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sol2 = solve(ocp2, grid_size=100, print_level=0, tol=1e-12)
3939
end
4040

4141

42-
# min tf (vectorial)
42+
# min tf (vector)
4343
ocp3 = Model(variable=true)
4444
state!(ocp3, 2)
4545
control!(ocp3, 1)
@@ -90,6 +90,7 @@ end
9090
end
9191
sol = solve(ocp, grid_size=100, print_level=0, tol=1e-12)
9292
@testset verbose = true showtiming = true ":double_integrator :min_tf :abstract" begin
93+
@test is_solvable(ocp)
9394
@test sol.objective 2.0 rtol=1e-2
9495
end
9596

test/suite/double_integrator_min_tf.jl

Lines changed: 0 additions & 76 deletions
This file was deleted.

test/suite/double_integrator_min_tf_abstract.jl

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/suite/simple_integrator.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using CTDirect
2+
using CTBase
3+
4+
println("Test: simple integrator")
5+
6+
# min energy
7+
ocp1 = Model()
8+
state!(ocp1, 1)
9+
control!(ocp1, 1)
10+
time!(ocp1, [0, 1])
11+
constraint!(ocp1, :initial, -1, :initial_constraint)
12+
constraint!(ocp1, :final, 0, :final_constraint)
13+
dynamics!(ocp1, (x, u) -> -x + u)
14+
objective!(ocp1, :lagrange, (x, u) -> u^2)
15+
init_constant = [-0.5, 0]
16+
sol1 = solve(ocp1, grid_size=100, print_level=0, tol=1e-12, init=init_constant)
17+
@testset verbose = true showtiming = true ":double_integrator :min_tf" begin
18+
@test sol1.objective 0.313 rtol=1e-2
19+
end

0 commit comments

Comments
 (0)