Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
moberg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mattias Fält
moberg
Commits
694fab34
Commit
694fab34
authored
6 years ago
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Add julia tests
parent
9e6d5436
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/Makefile
+10
-2
10 additions, 2 deletions
test/Makefile
test/test_jl.jl
+66
-0
66 additions, 0 deletions
test/test_jl.jl
with
76 additions
and
2 deletions
test/Makefile
+
10
−
2
View file @
694fab34
CTEST
=
test_start_stop test_io test_moberg4simulink
CTEST
=
test_start_stop test_io test_moberg4simulink
PYTEST
=
test_py
PYTEST
=
test_py
JULIATEST
=
test_jl
CCFLAGS
+=
-Wall
-Werror
-I
$(
shell
pwd
)
-g
CCFLAGS
+=
-Wall
-Werror
-I
$(
shell
pwd
)
-g
LDFLAGS
+=
-L
$(
shell
pwd
)
/build/
-lmoberg
LDFLAGS
+=
-L
$(
shell
pwd
)
/build/
-lmoberg
ENV_TEST
=
LD_LIBRARY_PATH
=
../build
XDG_CONFIG_HOME
=
.config
XDG_CONFIG_DIRS
=
.
ENV_TEST
=
LD_LIBRARY_PATH
=
../build
\
XDG_CONFIG_HOME
=
.config
\
XDG_CONFIG_DIRS
=
.
\
JULIA_LOAD_PATH
=
../adaptors/julia
LDFLAGS_test_moberg4simulink
=
-lmoberg4simulink
LDFLAGS_test_moberg4simulink
=
-lmoberg4simulink
CCFLAGS_test_moberg4simulink
=
-I
../adaptors/matlab
-Wall
-Werror
-I
$(
shell
pwd
)
-g
CCFLAGS_test_moberg4simulink
=
-I
../adaptors/matlab
-Wall
-Werror
-I
$(
shell
pwd
)
-g
PYTHON2PATH
=
$(
shell
realpath
../adaptors/python/install/usr/lib
*
/python2
*
/site-packages
)
PYTHON2PATH
=
$(
shell
realpath
../adaptors/python/install/usr/lib
*
/python2
*
/site-packages
)
...
@@ -10,7 +14,7 @@ PYTHON3PATH=$(shell realpath ../adaptors/python/install/usr/lib*/python3*/site-p
...
@@ -10,7 +14,7 @@ PYTHON3PATH=$(shell realpath ../adaptors/python/install/usr/lib*/python3*/site-p
all
:
all
:
.PHONY
:
test
.PHONY
:
test
test
:
$(PYTEST:%=run_py_%) $(CTEST:%=run_c_%)
test
:
$(PYTEST:%=run_py_%)
$(JULIATEST:%=run_jl_%)
$(CTEST:%=run_c_%)
echo
Tests run
echo
Tests run
.PHONY
:
run_c_%
.PHONY
:
run_c_%
...
@@ -22,6 +26,10 @@ run_py_%: %.py
...
@@ -22,6 +26,10 @@ run_py_%: %.py
$(
ENV_TEST
)
PYTHONPATH
=
$(
PYTHON2PATH
)
python2
$*
.py
$(
ENV_TEST
)
PYTHONPATH
=
$(
PYTHON2PATH
)
python2
$*
.py
$(
ENV_TEST
)
PYTHONPATH
=
$(
PYTHON3PATH
)
python3
$*
.py
$(
ENV_TEST
)
PYTHONPATH
=
$(
PYTHON3PATH
)
python3
$*
.py
.PHONY
:
run_jl_%
run_jl_%
:
%.jl
$(
ENV_TEST
)
julia
$*
.jl
.PRECIOUS
:
build/%
.PRECIOUS
:
build/%
build/%
:
%.c | build
build/%
:
%.c | build
...
...
This diff is collapsed.
Click to expand it.
test/test_jl.jl
0 → 100644
+
66
−
0
View file @
694fab34
#!/usr/bin/julia
push!
(
LOAD_PATH
,
"."
)
using
MobergIO
import
MobergIO
:
read
,
write
function
test
()
m
=
MobergIO
.
Moberg
()
println
(
m
)
for
v
in
-
10.0
:
2.0
:
10
for
i
in
0
:
1
try
aout
=
MobergIO
.
AnalogOut
(
m
,
Unsigned
(
i
))
value
=
v
+
i
;
write
(
aout
,
value
)
print
(
"
$
value "
)
catch
ex
println
(
"analog_out
$
i does not exist
$(ex)
"
)
end
end
println
()
sleep
(
0.01
)
for
j
in
0
:
3
try
ain
=
MobergIO
.
AnalogIn
(
m
,
Unsigned
(
j
))
println
(
read
(
ain
))
catch
ex
println
(
"analog_in
$
j does not exist
$(ex)
"
)
end
end
println
()
# GC.gc()
end
for
v
in
false
:
true
for
i
in
0
:
6
try
dout
=
MobergIO
.
DigitalOut
(
m
,
Unsigned
(
i
))
value
=
xor
(
v
,
isodd
(
i
))
write
(
dout
,
value
)
print
(
"
$
value "
)
catch
ex
println
(
"digital_out
$
i does not exist
$(ex)
"
)
end
end
println
()
for
i
in
0
:
6
try
din
=
MobergIO
.
DigitalIn
(
m
,
Unsigned
(
i
))
print
(
"
$
(read(din)) "
)
catch
ex
println
(
"digital_out
$
i does not exist
$(ex)
"
)
end
end
println
()
println
()
sleep
(
0.01
)
end
end
test
()
println
(
"DONE"
)
GC
.
gc
()
println
(
"Really DONE"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment