Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabConnections.jl
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fredrik Bagge Carlson
LabConnections.jl
Commits
d1fbbe64
Commit
d1fbbe64
authored
7 years ago
by
Marcus Greiff
Browse files
Options
Downloads
Patches
Plain Diff
Add unittesting for SysLED and GPIO IO operations
parent
d9d3a81b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/BeagleBone/GPIO_test.jl
+36
-0
36 additions, 0 deletions
test/BeagleBone/GPIO_test.jl
test/BeagleBone/Sys_LED_test.jl
+35
-0
35 additions, 0 deletions
test/BeagleBone/Sys_LED_test.jl
with
71 additions
and
0 deletions
test/BeagleBone/GPIO_test.jl
0 → 100644
+
36
−
0
View file @
d1fbbe64
include
(
"../../src/BeagleBone/BeagleBone.jl"
)
using
Base
.
Test
#Fixture
device
=
getdev
(
"gpio"
)
gpio_state
=
true
@testset
"GPIO Tests"
begin
@testset
"Error Handling"
begin
# Attempt to initialize faulty device
@test_throws
ErrorException
getdev
(
"wrong_device_name"
)
# Test that an exception is thrown when a faulty ID is given
@test_throws
ErrorException
write!
(
device
,
100
,
1
,
gpio_state
)
# Test that an exception is thrown when a faulty ID is given
@test_throws
ErrorException
write!
(
device
,
0
,
1
,
gpio_state
)
end
@testset
"IO Communication"
begin
# Instanciate all possible leds and perform 10 read/write commands
# with the set high/low operation (1)
operation
=
1
for
i
=
1
:
10
for
index
=
1
:
length
(
channels
)
write!
(
device
,
index
,
operation
,
gpio_state
)
end
sleep
(
0.01
)
#for j = 1:4
#val = read(device, j)
#@test val == gpio_state
#end
gpio_state
=
!
gpio_state
end
end
end
This diff is collapsed.
Click to expand it.
test/BeagleBone/Sys_LED_test.jl
0 → 100644
+
35
−
0
View file @
d1fbbe64
include
(
"../../src/BeagleBone/BeagleBone.jl"
)
using
Base
.
Test
#Fixture
device
=
getdev
(
"sysled"
)
ledon
=
true
@testset
"SYS LED Tests"
begin
@testset
"Error Handling"
begin
# Attempt to initialize faulty device
@test_throws
ErrorException
getdev
(
"wrong_device_name"
)
# Test that an exception is thrown when a faulty ID is given
@test_throws
ErrorException
write!
(
device
,
5
,
ledon
)
# Test that an exception is thrown when a faulty ID is given
@test_throws
ErrorException
write!
(
device
,
0
,
ledon
)
end
@testset
"IO Communication"
begin
# Instanciate all possible leds and perform 10 read/write commands
for
i
=
1
:
10
for
j
=
1
:
4
write!
(
device
,
j
,
ledon
)
end
sleep
(
0.001
)
for
j
=
1
:
4
val
=
read
(
device
,
j
)
@test
val
==
ledon
end
ledon
=
!
ledon
end
end
end
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