Created
December 1, 2016 12:39
-
-
Save bjackman/7138e3b4a5fa9791f229728f8e218a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hypothesis import given | |
from hypothesis.strategies import integers | |
import unittest | |
from pelt import * | |
class TestSimulator(unittest.TestCase): | |
@given(x=integers(min_value=1), y=integers(min_value=1)) | |
def test_range_below_max(self, x, y): | |
period = max(x, y) | |
run = min(x, y) | |
t = Task(period, run) | |
s = Simulator() | |
r = s.stable_range(t) | |
self.assertLessEqual(r.max_value, s._signal_max) | |
@given(x=integers(min_value=1), y=integers(min_value=1)) | |
def test_signal_within_range(self, x, y): | |
period = max(x, y) | |
run = min(x, y) | |
t = Task(period, run) | |
s = Simulator(init_util=0) | |
stable_range = s.stable_range(t) | |
signal = s.signal(t) | |
signal_max = signal.max()['util_avg'] | |
self.assertLessEqual(signal_max, s._signal_max) | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment