Revision: 41
http://python-control.svn.sourceforge.net/python-control/?rev=41&view=rev
Author: kkchen
Date: 2011-02-08 22:13:09 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Added rss unit tests.
Kevin K. Chen <kk...@pr...>
Added Paths:
-----------
branches/control-0.4a/src/TestStateSp.py
Added: branches/control-0.4a/src/TestStateSp.py
===================================================================
--- branches/control-0.4a/src/TestStateSp.py (rev 0)
+++ branches/control-0.4a/src/TestStateSp.py 2011-02-08 22:13:09 UTC (rev 41)
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import numpy as np
+import statesp as ss
+import unittest
+
+class TestRss(unittest.TestCase):
+ """These are tests for the proper functionality of statesp.rss."""
+
+ def setUp(self):
+ # Number of times to run each of the randomized tests.
+ self.numTests = 100
+
+ def testShape(self):
+ """Test that rss outputs have the right state, input, and output
+ size."""
+
+ for states in range(1, 10):
+ for inputs in range(1, 5):
+ for outputs in range(1, 5):
+ sys = ss.rss(states, inputs, outputs)
+ self.assertEqual(sys.states, states)
+ self.assertEqual(sys.inputs, inputs)
+ self.assertEqual(sys.outputs, outputs)
+
+ def testPole(self):
+ """Test that the poles of rss outputs have a negative real part."""
+
+ for states in range(1, 10):
+ for inputs in range(1, 5):
+ for outputs in range(1, 5):
+ sys = ss.rss(states, inputs, outputs)
+ p = sys.poles()
+ for z in p:
+ self.assertTrue(z.real < 0)
+
+if __name__ == "__main__":
+ unittest.main()
\ No newline at end of file
Property changes on: branches/control-0.4a/src/TestStateSp.py
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|