Skip to content

Commit

Permalink
modified: src/dash_cli.jl
Browse files Browse the repository at this point in the history
	modified:   src/data_cli.jl
	modified:   src/model_cli.jl
	modified:   test/controller_cli_test.jl
	modified:   test/dash_cli_test.jl
	modified:   test/data_cli_test.jl
	modified:   test/exportation_cli_test.jl
	modified:   test/model_cli_test.jl
	modified:   test/project_cli_test.jl
	modified:   test/system_cli_test.jl
  • Loading branch information
Pierre BLAUD committed Apr 18, 2023
1 parent 1c6e6af commit 0aa61fc
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dash_cli.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function dash(args; kws...)
else
# Wrong arguments
@error "Unrecognized argument"
result = nothing
end

#to do more?
Expand Down
1 change: 1 addition & 0 deletions src/data_cli.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function data(args; kws...)
else
# Wrong arguments
@error "Unrecognized argument"
rslt = nothing
end

return rslt
Expand Down
1 change: 1 addition & 0 deletions src/model_cli.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function model(args; kws...)
else
# Wrong arguments
@error "Unrecognized argument"
rslt = nothing
end

#to do more?
Expand Down
47 changes: 47 additions & 0 deletions test/controller_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -574,4 +574,51 @@ end

end

@testset "Controller error message test" begin

rslt = controller(:ki)
@test rslt == nothing

rslt = controller(:ls, project_ = "1")
@test rslt == nothing

rslt = controller(:rm, project = "1")
@test rslt == nothing

rslt = controller(:rm, project_name = "1")
@test rslt == nothing

rslt = controller(:tune, project = "1")
@test rslt == nothing

rslt = controller(:tune, project_name = "1")
@test rslt == nothing

rslt = controller(:tune, project_name = "1", system_name = "1")
@test rslt == nothing

rslt = controller(:tune, project_name = "1", system_name = "1", mpc_horizon = 1)
@test rslt == nothing

rslt = controller(:tune, project_name = "1", system_name = "1", mpc_horizon = 1, mpc_sample_time = 5)
@test rslt == nothing

rslt = controller(:tune, project_name = "1", system_name = "1", mpc_horizon = 1, mpc_sample_time = 5, mpc_state_reference = 1)
@test rslt == nothing

rslt = controller(:calculate)
@test rslt == nothing

rslt = controller(:calculate, initialization = 1)
@test rslt == nothing

#rslt = controller(:calculate, initialization = 1, controller_name = "1")
#@test rslt == nothing

rslt = controller(:retrieve)
@test rslt == nothing

end


end
46 changes: 46 additions & 0 deletions test/dash_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,50 @@ end

end

@testset "Dash error message test" begin

rslt = dash(:ki)
@test rslt == nothing

rslt = dash(:rawdata, project_ = "1")
@test rslt == nothing

rslt = dash(:rawdata, project_name = "1")
@test rslt == nothing

rslt = dash(:rawdata, project_name = "1", data_name = "1")
@test rslt == nothing

rslt = dash(:rawdata, project_name = "1", data_name = "1", recipe = "1")
@test rslt == nothing

rslt = dash(:iodata, project_ = "1")
@test rslt == nothing

rslt = dash(:iodata, project_name = "1")
@test rslt == nothing

rslt = dash(:iodata, project_name = "1", data_name = "1")
@test rslt == nothing

rslt = dash(:iodata, project_name = "1", data_name = "1", recipe = "1")
@test rslt == nothing

rslt = dash(:model, project_ = "1")
@test rslt == nothing

rslt = dash(:model, project_name = "1")
@test rslt == nothing

rslt = dash(:ls, project = "1")
@test rslt == nothing

rslt = dash(:rm, project = "1")
@test rslt == nothing

rslt = dash(:rm, project_name = "1")
@test rslt == nothing

end

end
50 changes: 50 additions & 0 deletions test/data_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,54 @@ using AutomationLabs

end

@testset "Data error message test" begin

rslt = data(:ki)
@test rslt == nothing

rslt = data(:add, project_ = "1")
@test rslt == nothing

rslt = data(:add, project = "1")
@test rslt == nothing

rslt = data(:add, project_name = "1")
@test rslt == nothing

rslt = data(:add, project_name = "1", path = "1")
@test rslt == nothing

rslt = data(:lsio, project = "1")
@test rslt == nothing

rslt = data(:lsraw, project = "1")
@test rslt == nothing

rslt = data(:rmio, project = "1")
@test rslt == nothing

rslt = data(:rmraw, project = "1")
@test rslt == nothing

rslt = data(:rmio, project_name = "1")
@test rslt == nothing

rslt = data(:rmraw, project_name = "1")
@test rslt == nothing

rslt = data(:io, project = "1")
@test rslt == nothing

rslt = data(:io, project_name = "1")
@test rslt == nothing

rslt = data(:io, project_name = "1", inputs_data_name = "1")
@test rslt == nothing

#rslt = data(:io, project_name = "1", inputs_data_name = "1", outputs_data_name = "1")
#@test rslt == nothing
# Add a protect

end

end
28 changes: 28 additions & 0 deletions test/exportation_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,32 @@ using Dates

end

@testset "Exportation error message test" begin

rslt = exportation(:ki)
@test rslt == nothing

rslt = exportation(:ls, project_ = "1")
@test rslt == nothing

rslt = exportation(:rm, project = "1")
@test rslt == nothing

rslt = exportation(:rm, project_name = "1")
@test rslt == nothing

rslt = exportation(:tune, project = "1")
@test rslt == nothing

rslt = exportation(:tune, project_name = "1")
@test rslt == nothing

rslt = exportation(:tune, project_name = "1", model_name = "1")
@test rslt == true #should be false or nothing

#rslt = exportation(:tune, project_name = "1", controller_name = "1")
#@test rslt == true

end

end
49 changes: 49 additions & 0 deletions test/model_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,54 @@ end

end

@testset "Model error message test" begin

rslt = model(:ki)
@test rslt == nothing

rslt = model(:tune, projectç = "1")
@test rslt == nothing

rslt = model(:tune, project_name = "1")
@test rslt == nothing

#rslt = model(:tune, project_name = "1", io = "1") return issue
#@test rslt == nothing

rslt = model(:ls, projectc = "1")
@test rslt == nothing

rslt = model(:rm, project = "1")
@test rslt == nothing

rslt = model(:rm, project_name = "1")
@test rslt == nothing

rslt = model(:stats, project = "1")
@test rslt == nothing

rslt = model(:stats, project_name = "1")
@test rslt == nothing

rslt = model(:create, project = "1")
@test rslt == nothing

rslt = model(:create, project_name = "1")
@test rslt == nothing

rslt = model(:create, project_name = "1", model_anme = "1")
@test rslt == nothing

rslt = model(:create, project_name = "1", model_anme = "1", nbr_state = 2)
@test rslt == nothing

rslt = model(:create, project_name = "1", model_anme = "1", nbr_state = 2, nbr_input = 2)
@test rslt == nothing

rslt = model(:create, project_name = "1", model_anme = "1", nbr_state = 2, nbr_input = 2, variation = "1")
@test rslt == nothing

end


end
3 changes: 3 additions & 0 deletions test/project_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ end
rslt = project(:rm, name = "gt")
@test rslt == false

rslt = project(:rm, namez = "gt")
@test rslt == nothing

rslt = project(:rm, name = pjt[1])
@test rslt == true

Expand Down
2 changes: 2 additions & 0 deletions test/system_cli_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ end
system(:ls, project_name = "qtp_test", show_all = true)
rslt = system(:ls, project_name = "gt")
@test size(rslt) == (0, 6)
rslt = system(:ls, project_namezz = "gt")
@test rslt == nothing

# Wrong rm
rslt = system(:rm, project_name = "qtp_test")
Expand Down

0 comments on commit 0aa61fc

Please sign in to comment.