text: /******************************************************************************
   * Copyright 2017 The Apollo Authors. All Rights Reserved.
   * Modifications Copyright (c) 2018 LG Electronics, Inc. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *****************************************************************************/
  
  #include "modules/drivers/canbus/can_client/hermes_can/hermes_can_client.h"
  #include "gtest/gtest.h"
  
  namespace apollo {
  namespace drivers {
  namespace canbus {
  namespace can {
  
  using apollo::common::ErrorCode;
  
  TEST(HermesCanClient, init) {
    CANCardParameter param;
    param.set_brand(CANCardParameter::HERMES_CAN);
    param.set_channel_id(CANCardParameter::CHANNEL_ID_ZERO);
    HermesCanClient hermes_can;
    EXPECT_TRUE(hermes_can.Init(param));
    //    EXPECT_EQ(hermes_can.Start(), ErrorCode::CAN_CLIENT_ERROR_BASE);
    //      EXPECT_EQ(hermes_can.Start(), ErrorCode::OK);
  }
  
  /*
  TEST(HermesCanClient, send) {
    CANCardParameter param;
    param.set_brand(CANCardParameter::HERMES_CAN);
    param.set_channel_id(CANCardParameter::CHANNEL_ID_ZERO);
    HermesCanClient hermes_can;
    EXPECT_TRUE(hermes_can.Init(param));
  
    // CanFrame can_frame[1];
    std::vector<CanFrame> frames;
    int32_t num = 0;
  
    CanFrame frame;
    frame.id = 0x60;
    frame.len = 8;
    frame.data[0] = 0;
    EXPECT_EQ(hermes_can.Send(frames, &num),
              ErrorCode::CAN_CLIENT_ERROR_SEND_FAILED);
  
    frames.push_back(frame);
    num = 1;
    EXPECT_EQ(hermes_can.Start(), ErrorCode::OK);
    EXPECT_EQ(hermes_can.Send(frames, &num), ErrorCode::OK);
    frames.clear();
  }
  
  TEST(HermesCanClient, receiver) {
    CANCardParameter param;
    param.set_brand(CANCardParameter::HERMES_CAN);
    param.set_channel_id(CANCardParameter::CHANNEL_ID_ZERO);
    HermesCanClient hermes_can;
    EXPECT_TRUE(hermes_can.Init(param));
  
    std::vector<CanFrame> frames;
    int32_t num = 0;
    CanFrame frame;
    // frame.id = 0x60;
    // frame.len = 8;
    // frame.data[0] = 0;
    // frames.push_back(frame);
    // num = 1;
    EXPECT_EQ(hermes_can.Start(), ErrorCode::OK);
    EXPECT_EQ(hermes_can.Receive(&frames, &num), ErrorCode::OK);
  }
  */
  }  // namespace can
  }  // namespace canbus
  }  // namespace drivers
  }  // namespace apollo
  
  int main(int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    int ret = RUN_ALL_TESTS();
    return ret;
  }
  