1 # Copyright 2015-2017 ARM Limited 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 # 15 16 17 import matplotlib 18 19 from test_thermal import BaseTestThermal 20 import trappy 21 22 class TestPIDController(BaseTestThermal): 23 def test_dataframe(self): 24 """Test that PIDController() generates a valid data_frame""" 25 pid = trappy.FTrace().pid_controller 26 27 self.assertTrue(len(pid.data_frame) > 0) 28 self.assertTrue("err_integral" in pid.data_frame.columns) 29 self.assertEquals(pid.data_frame["err"].iloc[0], 3225) 30 31 def test_plot_controller(self): 32 """Test PIDController.plot_controller() 33 34 As it happens with all plot functions, just test that it doesn't explode""" 35 pid = trappy.FTrace().pid_controller 36 37 pid.plot_controller() 38 matplotlib.pyplot.close('all') 39 40 pid.plot_controller(title="Antutu", width=20, height=5) 41 matplotlib.pyplot.close('all') 42 43 _, ax = matplotlib.pyplot.subplots() 44 pid.plot_controller(ax=ax) 45 matplotlib.pyplot.close('all') 46