20 sys.path.insert(1,
"../")
23 from TimeMeasure
import *
40 print "count: ", self.
_tm.count()
41 print "result: ", self.
_tm.getStatistics(_max, _min, _mean, _stddev)
42 print "max: ", _max[0]
43 print "min: ", _min[0]
44 print "mean: ", _mean[0]
45 print "stddev: ", _stddev[0]
50 self.assertEqual(0, tm_.count())
56 self.assertEqual(10, tm_.count())
59 self.assertEqual(0, tm_.count())
66 self.assertNotEqual(102, tm_.count())
76 self.assertEqual(
False, tm_.getStatistics(maxi, mini, mean, stdev))
78 self.assertEqual(
False, tm_.getStatistics(maxi, mini, mean, stdev))
80 self.assertEqual(
True, tm_.getStatistics(maxi, mini, mean, stdev))
82 self.assertEqual(
False, tm_.getStatistics(maxi, mini, mean, stdev))
87 self.assertEqual(0, tm_0.count())
90 self.assertEqual(1, tm_0.count())
95 for i
in range(count_):
96 self.assertEqual(i, tm_1.count())
100 for i
in range(count_):
103 self.assertEqual(count_ + 1, tm_1.count())
118 tm_.getStatistics(maxi, mini, mean, stdev)
120 print "max interval : ", maxi[0],
" [sec]" 121 print "min interval : ", mini[0],
" [sec]" 122 print "mean interval: ", mean[0],
" [sec]" 123 print "stddev : ", stdev[0],
" [sec]" 124 self.assert_(maxi[0] < (wait_ + 0.030))
125 self.assert_(mini[0] > (wait_ - 0.010))
126 self.assert_(math.fabs(mean[0] - wait_) < 0.03)
127 self.assert_(stdev[0] < (wait_ / 5.0))
142 tm_.getStatistics(maxi, mini, mean, stdev)
144 print "max interval : ", maxi[0],
" [sec]" 145 print "min interval : ", mini[0],
" [sec]" 146 print "mean interval: ", mean[0],
" [sec]" 147 print "stddev : ", stdev[0],
" [sec]" 148 self.assert_(maxi[0] < (wait_ + 0.030))
149 self.assert_(mini[0] > (wait_ - 0.010))
150 self.assert_(math.fabs(mean[0] - wait_) < 0.03)
151 self.assert_(stdev[0] < (wait_ / 5.0))
155 if __name__ ==
'__main__':