diff options
author | rcoh <rcoh@mit.edu> | 2011-02-12 15:59:59 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-02-12 15:59:59 -0500 |
commit | 4d62e1152241854ab864142d827d735d84405078 (patch) | |
tree | 2589c6a37721e1b8362c8e8c6a580c8c185b2f86 /tests | |
parent | b45b9079c5decd720d8275378bb0d6dc172c6234 (diff) |
Modified the test code to automatically pick up new tests. Just add your test file to
tests/__init__.py. Fixed a bug in ZigZagLayout. Added the BehaviorQuerySystem to allow querying
on behaviors. Added the "ModulateColor" behavior which will continually shift a color along the HSV
plane. Added TestBQS to test the behavior query system. Modified Behavior to have a getLastOutput
and setLastOutput method.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TestBQS.py | 18 | ||||
-rw-r--r-- | tests/__init__.py | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/TestBQS.py b/tests/TestBQS.py new file mode 100644 index 0000000..8dc90b2 --- /dev/null +++ b/tests/TestBQS.py @@ -0,0 +1,18 @@ +import unittest +import util.BehaviorQuerySystem as bqs +from behaviors.ColorChangerBehavior import * +class TestBQS(unittest.TestCase): + def setUp(self): + bqs.initBQS() + b = ColorChangerBehavior({'Id': 'color','ColorList':[(255,0,0)]}) + bqs.addBehavior(b) + b.addInput({'Location':(5,5)}) + b.timeStep() + def tearDown(self): + bqs.initBQS() + + def test_color_predicate(self): + validQuery = lambda args:args['Color']==(255,0,0) + invalidQuery = lambda args:args['Color']==(254,0,0) + assert bqs.query(validQuery) == [{'Color':(255,0,0), 'Location':(5,5)}] + assert bqs.query(invalidQuery) == [] diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..0365616 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,3 @@ +from TestComponentRegistry import TestComponentRegistry +from TestConfigLoaders import TestConfigLoaders +from TestBQS import TestBQS |