3Copyright (c) 2011-2013 ARM Limited
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11Unless required by applicable law or agreed to
in writing, software
12distributed under the License
is distributed on an
"AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.
14See the License
for the specific language governing permissions
and
15limitations under the License.
19from mbed_host_tests import BaseHostTest
22class WaitusTest(BaseHostTest):
23 """ This test is reading single characters from stdio
24 and measures time between their occurrences.
30 def _callback_exit(self, key, value, timeout):
31 self.notify_complete()
33 def _callback_tick(self, key, value, timestamp):
35 self.log(
"tick! " + str(timestamp))
36 self.
ticks.append((key, value, timestamp))
43 def sub_timestamps(t1, t2):
45 deviation = abs(delta - 1.0)
52 timestamps = [timestamp
for _, _, timestamp
in self.
ticks]
53 self.log(str(timestamps))
54 m = map(sub_timestamps, timestamps[1:], timestamps[:-1])
def _callback_exit(self, key, value, timeout)
def _callback_tick(self, key, value, timestamp)