3 #include <gtest/gtest.h>
12 #define LOWBATTERY "LowBattery"
15 struct cpu_device *cpu_dev;
17 class CPUHalTest : public testing::Test
25 virtual void TearDown()
34 TEST_F(CPUHalTest, InitP)
38 ret = hw_get_info(CPU_HARDWARE_DEVICE_ID,
39 (const struct hw_info **)&info);
41 cout << "There is no device for cpu " << ret << endl;
44 EXPECT_EQ(ret, 0) << "Fail to load cpu hal (" << ret << ")";
46 if (!info || !info->open) {
47 cout << "There is no function for info open" << endl;
50 ret = info->open(info, NULL, (struct hw_common**)&cpu_dev);
51 EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
54 TEST_F(CPUHalTest, StartBoostP)
58 if (!cpu_dev || !cpu_dev->start_boost) {
59 cout << "There is no function for start_boost" << endl;
64 ret = cpu_dev->start_boost((void *)LOWBATTERY);
65 EXPECT_EQ(ret, 0) << "Fail to start_boost (" << ret << ")";
68 TEST_F(CPUHalTest, StopBoostP)
72 if (!cpu_dev || !cpu_dev->stop_boost) {
73 cout << "There is no function for stop_boost" << endl;
78 ret = cpu_dev->stop_boost((void *)LOWBATTERY);
79 EXPECT_EQ(ret, 0) << "Fail to stop_boost (" << ret << ")";
82 TEST_F(CPUHalTest, DeinitP)
86 if (!info || !info->close) {
87 cout << "There is no function for info close" << endl;
91 ret = info->close((struct hw_common *)cpu_dev);
92 EXPECT_EQ(ret, 0) << "Fail to open cpu device (" << ret << ")";
95 int main(int argc, char **argv)
97 testing::InitGoogleTest(&argc, argv);
99 return RUN_ALL_TESTS();