Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
1cf3fed3
Commit
1cf3fed3
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Updated tests
parent
b46732b8
No related branches found
No related tags found
1 merge request
!1
Issue #6 Base simulator class and methods
Pipeline
#41151
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_start.py
+14
-10
14 additions, 10 deletions
tests/test_start.py
with
14 additions
and
10 deletions
tests/test_start.py
+
14
−
10
View file @
1cf3fed3
...
...
@@ -6,17 +6,21 @@ import time
def
test_player_registration
():
sim
=
Simulator
()
p1
=
Player
(
"
player
"
,
np
.
array
([
0
,
0
]))
sim
=
Simulator
(
Environment
,
200
)
p1
=
Player
(
"
player
1
"
,
np
.
array
([
0
,
0
]))
sim
.
register_player
(
p1
)
assert
len
(
sim
.
env
.
players
)
!=
0
assert
len
(
sim
.
env
.
players
)
==
1
assert
len
(
sim
.
env
.
players
)
!=
0
,
"
Wrong number of players
"
assert
len
(
sim
.
env
.
players
)
==
1
,
"
Wrong number of players
"
p2
=
Player
(
"
player
"
,
np
.
array
([
100
,
100
]))
p2
=
Player
(
"
player
2
"
,
np
.
array
([
100
,
100
]))
sim
.
register_player
(
p2
)
assert
len
(
sim
.
env
.
players
)
==
2
assert
len
(
sim
.
env
.
players
)
==
2
,
"
Wrong number of players
"
p3
=
Player
(
"
player2
"
,
np
.
array
([
100
,
100
]))
sim
.
register_player
(
p2
)
# same player name
assert
len
(
sim
.
env
.
players
)
==
2
,
"
Wrong number of players
"
sim
.
start
()
sim
.
stop
()
...
...
@@ -30,16 +34,16 @@ def test_simulator_frequency():
self
.
c
+=
1
frequency
=
1000
running_time_seconds
=
5
running_time_seconds
=
8
sim
=
Simulator
(
TestEnv
,
frequency
)
sim
.
start
()
sim
.
start
()
time
.
sleep
(
running_time_seconds
)
sim
.
stop
()
accepted_tolerance
=
0.04
print
(
sim
.
env
.
c
)
accepted_tolerance
=
0.02
lower
=
frequency
*
running_time_seconds
*
(
1
-
accepted_tolerance
)
upper
=
frequency
*
running_time_seconds
*
(
1
+
accepted_tolerance
)
assert
sim
.
env
.
c
>
lower
and
sim
.
env
.
c
<
upper
,
"
Timing error in the environment at 1000hz
"
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