summaryrefslogtreecommitdiff
path: root/unittest/gtest_hal_ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/gtest_hal_ir.cpp')
-rwxr-xr-xunittest/gtest_hal_ir.cpp111
1 files changed, 0 insertions, 111 deletions
diff --git a/unittest/gtest_hal_ir.cpp b/unittest/gtest_hal_ir.cpp
deleted file mode 100755
index 4b77f20..0000000
--- a/unittest/gtest_hal_ir.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <iostream>
-#include <gtest/gtest.h>
-#include <system_info.h>
-#include "hw/ir.h"
-#include "unittest.h"
-
-using namespace std;
-
-/*
- * main class
- */
-struct hw_info *info;
-struct ir_device *ir_dev;
-static bool need_featurecheck = true;
-
-class IRHalTest : public testing::Test
-{
- public:
- virtual void SetUp()
- {
- int ret;
-
- if (need_featurecheck) {
- ret = system_info_get_platform_bool(FEATURE_IR, &supported);
- EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
- need_featurecheck = false;
- }
- }
-
- virtual void TearDown()
- {
-
- }
-};
-
-/*
- * testcase
- */
-TEST_F(IRHalTest, InitP)
-{
- int ret;
-
- if (!supported)
- return;
-
- ret = hw_get_info(IR_HARDWARE_DEVICE_ID,
- (const struct hw_info **)&info);
- EXPECT_EQ(ret, 0) << "Fail to get hal for ir (" << ret << ")";
-
- if (!info->open) {
- cout << "There is no function for info open" << endl;
- return;
- }
- ret = info->open(info, NULL, (struct hw_common**)&ir_dev);
- EXPECT_EQ(ret, 0) << "Fail to open ir device (" << ret << ")";
-}
-
-TEST_F(IRHalTest, IsAvailableP)
-{
- int ret;
- bool val;
-
- if (!supported)
- return;
-
- if (!ir_dev->is_available) {
- cout << "There is no function for is_available" << endl;
- return;
- }
- ret = ir_dev->is_available(&val);
- EXPECT_EQ(ret, 0) << "Fail to is_available (" << ret << ")";
-}
-
-TEST_F(IRHalTest, TransmitP)
-{
- int ret;
- int pattern[5] = {100, 200, 300, 400, 500};
-
- if (!supported)
- return;
-
- if (!ir_dev->transmit) {
- cout << "There is no function for transmit" << endl;
- return;
- }
- ret = ir_dev->transmit(pattern, 5);
- EXPECT_EQ(ret, 0) << "Fail to transmit (" << ret << ")";
-}
-
-TEST_F(IRHalTest, DeinitP)
-{
- int ret;
-
- if (!supported)
- return;
-
- if (!info->close) {
- cout << "There is no function for info close" << endl;
- return;
- }
- ret = info->close((struct hw_common *)ir_dev);
- EXPECT_EQ(ret, 0) << "Fail to close ir device (" << ret << ")";
-}
-
-int main(int argc, char **argv)
-{
- testing::InitGoogleTest(&argc, argv);
-
- return RUN_ALL_TESTS();
-}