Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
ipaaca
Commits
4e0ac1d3
Commit
4e0ac1d3
authored
13 years ago
by
Ramin Yaghoubzadeh
Browse files
Options
Downloads
Patches
Plain Diff
Added first test case. Found approx 10 bugs.
parent
667acc1d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/src/ipaaca.py
+2
-2
2 additions, 2 deletions
python/src/ipaaca.py
python/src/testipaaca.py
+31
-0
31 additions, 0 deletions
python/src/testipaaca.py
with
33 additions
and
2 deletions
python/src/ipaaca.py
+
2
−
2
View file @
4e0ac1d3
...
...
@@ -215,7 +215,7 @@ class IUInterface(object): #{{{
def
_replace_links
(
self
,
links
):
'''
Just wipe and replace our links set, do not send an update here
'''
'''
Note: Also used for remotely enforced links updates.
'''
self
.
_links
=
{}
self
.
_links
=
collections
.
defaultdict
(
set
)
for
type
in
links
.
keys
():
self
.
_links
[
type
]
|=
set
(
links
[
type
])
def
add_links
(
self
,
type
,
targets
,
writer_name
=
None
):
...
...
@@ -239,7 +239,7 @@ class IUInterface(object): #{{{
'''
Attempt to set (replace) links if the conditions are met
and send an update message. Then call the local setter.
'''
self
.
_modify_links
(
links
=
self
,
is_delta
=
False
,
new_links
=
links
,
links_to_remove
=
{},
writer_name
=
writer_name
)
self
.
_replace_links
(
links
=
new_
links
)
self
.
_replace_links
(
links
=
links
)
def
get_links
(
self
,
type
):
return
set
(
self
.
_links
[
type
])
def
get_all_links
(
self
):
...
...
This diff is collapsed.
Click to expand it.
python/src/testipaaca.py
0 → 100755
+
31
−
0
View file @
4e0ac1d3
#!/usr/bin/env python
import
time
import
ipaaca
import
sys
import
unittest
class
IpaacaLinksTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ib
=
ipaaca
.
InputBuffer
(
'
TestIn
'
,
[
'
sensorcategory
'
])
self
.
ob
=
ipaaca
.
OutputBuffer
(
'
TestOut
'
)
self
.
sensor_iu
=
ipaaca
.
IU
(
'
sensorcategory
'
)
self
.
sensor_iu
.
payload
=
{
'
data
'
:
'
sensordata
'
}
self
.
ob
.
add
(
self
.
sensor_iu
)
def
tearDown
(
self
):
pass
def
testSetLink
(
self
):
time
.
sleep
(
0.1
)
self
.
decision_iu
=
ipaaca
.
IU
(
'
decisioncategory
'
)
self
.
decision_iu
.
payload
=
{
'
data
'
:
'
decision
'
}
self
.
decision_iu
.
set_links
(
{
'
grin
'
:
[
self
.
sensor_iu
.
uid
]
}
)
self
.
ob
.
add
(
self
.
decision_iu
)
time
.
sleep
(
0.1
)
grinlinks
=
self
.
decision_iu
.
get_links
(
'
grin
'
)
self
.
assertIn
(
self
.
sensor_iu
.
uid
,
grinlinks
)
self
.
assertEqual
(
len
(
grinlinks
),
1
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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