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
16import pandas as pd
17
18import trappy
19from test_thermal import BaseTestThermal
20
21class TestDevfreqPower(BaseTestThermal):
22    """Tests for the DevfreqInPower and DevfreqOutPower classes"""
23
24    def test_devfreq_inp_dataframe(self):
25        """Test that DevfreqInPower creates proper data frames"""
26        devfreq_in_power = trappy.FTrace().devfreq_in_power
27
28        self.assertTrue("freq" in devfreq_in_power.data_frame.columns)
29
30    def test_devfreq_outp_dataframe(self):
31        """Test that DevfreqOutPower creates proper data frames"""
32        devfreq_out_power = trappy.FTrace().devfreq_out_power
33
34        self.assertTrue("freq" in devfreq_out_power.data_frame.columns)
35
36    def test_get_inp_all_freqs(self):
37        """Test that DevfreqInPower get_all_freqs() work"""
38
39        all_freqs = trappy.FTrace().devfreq_in_power.get_all_freqs()
40        self.assertTrue(isinstance(all_freqs, pd.DataFrame))
41
42        self.assertEquals(all_freqs["freq"].iloc[0], 525)
43
44    def test_get_outp_all_freqs(self):
45        """Test that DevfreqOutPower get_all_freqs() work"""
46
47        all_freqs = trappy.FTrace().devfreq_out_power.get_all_freqs()
48        self.assertTrue(isinstance(all_freqs, pd.DataFrame))
49
50        self.assertEquals(all_freqs["freq"].iloc[0], 525)
51