File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import numpy as np
4+ import statesp as ss
5+ import unittest
6+
7+ class TestRss (unittest .TestCase ):
8+ """These are tests for the proper functionality of statesp.rss."""
9+
10+ def setUp (self ):
11+ # Number of times to run each of the randomized tests.
12+ self .numTests = 100
13+
14+ def testShape (self ):
15+ """Test that rss outputs have the right state, input, and output
16+ size."""
17+
18+ for states in range (1 , 10 ):
19+ for inputs in range (1 , 5 ):
20+ for outputs in range (1 , 5 ):
21+ sys = ss .rss (states , inputs , outputs )
22+ self .assertEqual (sys .states , states )
23+ self .assertEqual (sys .inputs , inputs )
24+ self .assertEqual (sys .outputs , outputs )
25+
26+ def testPole (self ):
27+ """Test that the poles of rss outputs have a negative real part."""
28+
29+ for states in range (1 , 10 ):
30+ for inputs in range (1 , 5 ):
31+ for outputs in range (1 , 5 ):
32+ sys = ss .rss (states , inputs , outputs )
33+ p = sys .poles ()
34+ for z in p :
35+ self .assertTrue (z .real < 0 )
36+
37+ if __name__ == "__main__" :
38+ unittest .main ()
You can’t perform that action at this time.
0 commit comments