1323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui/* 2323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * Copyright (C) 2015 The Android Open Source Project 3323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * 4323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * Licensed under the Apache License, Version 2.0 (the "License"); 5323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * you may not use this file except in compliance with the License. 6323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * You may obtain a copy of the License at 7323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * 8323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * http://www.apache.org/licenses/LICENSE-2.0 9323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * 10323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * Unless required by applicable law or agreed to in writing, software 11323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * distributed under the License is distributed on an "AS IS" BASIS, 12323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * See the License for the specific language governing permissions and 14323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui * limitations under the License. 15323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui */ 16323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui 17323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui#include <gtest/gtest.h> 18323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui 197d59bb49fb47fbc82ef5c77d7aebf7174fd996e1Yabin Cui#include "command.h" 20323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui 21f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cuiclass ListCommandTest : public ::testing::Test { 22f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui protected: 23f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui virtual void SetUp() { 24f79f07e13c56f7ca3be1435cea7f8861daf7efaaYabin Cui list_cmd = CreateCommandInstance("list"); 25f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui ASSERT_TRUE(list_cmd != nullptr); 26f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui } 27f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui 28f79f07e13c56f7ca3be1435cea7f8861daf7efaaYabin Cui std::unique_ptr<Command> list_cmd; 29f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui}; 30f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui 31f569b478e74560a2d9e29a96824e16b93a55b97fYabin CuiTEST_F(ListCommandTest, no_options) { 32f79f07e13c56f7ca3be1435cea7f8861daf7efaaYabin Cui ASSERT_TRUE(list_cmd->Run({})); 33323e945313b190373b3fcfe578e25ee8390a76d3Yabin Cui} 34f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui 35f569b478e74560a2d9e29a96824e16b93a55b97fYabin CuiTEST_F(ListCommandTest, one_option) { 36f79f07e13c56f7ca3be1435cea7f8861daf7efaaYabin Cui ASSERT_TRUE(list_cmd->Run({"sw"})); 37f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui} 38f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui 39f569b478e74560a2d9e29a96824e16b93a55b97fYabin CuiTEST_F(ListCommandTest, multiple_options) { 40f79f07e13c56f7ca3be1435cea7f8861daf7efaaYabin Cui ASSERT_TRUE(list_cmd->Run({"hw", "tracepoint"})); 41f569b478e74560a2d9e29a96824e16b93a55b97fYabin Cui} 42