148f512ceSopenharmony_ci/*
248f512ceSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
348f512ceSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
448f512ceSopenharmony_ci * you may not use this file except in compliance with the License.
548f512ceSopenharmony_ci * You may obtain a copy of the License at
648f512ceSopenharmony_ci *
748f512ceSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
848f512ceSopenharmony_ci *
948f512ceSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1048f512ceSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1148f512ceSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1248f512ceSopenharmony_ci * See the License for the specific language governing permissions and
1348f512ceSopenharmony_ci * limitations under the License.
1448f512ceSopenharmony_ci */
1548f512ceSopenharmony_ci
1648f512ceSopenharmony_ci#ifndef HIPERF_OPTION_TEST_H
1748f512ceSopenharmony_ci#define HIPERF_OPTION_TEST_H
1848f512ceSopenharmony_ci
1948f512ceSopenharmony_ci#include <gmock/gmock.h>
2048f512ceSopenharmony_ci#include <gtest/gtest.h>
2148f512ceSopenharmony_ci
2248f512ceSopenharmony_ci#include "option.h"
2348f512ceSopenharmony_ci
2448f512ceSopenharmony_cinamespace OHOS {
2548f512ceSopenharmony_cinamespace Developtools {
2648f512ceSopenharmony_cinamespace HiPerf {
2748f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_EMPTY = "";
2848f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_NO_PREFIX = "TEST_OPTION_CMD";
2948f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_ERR_PREFIX = "TEST_OPTION_CMD";
3048f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_1 = "-TEST_OPTION_CMD_1";
3148f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_2 = "-TEST_OPTION_CMD_2";
3248f512ceSopenharmony_cistatic std::string TEST_OPTION_CMD_3 = "-TEST_OPTION_CMD_3";
3348f512ceSopenharmony_cistatic std::string TEST_NO_OPTION_CMD = "TEST_NO_OPTION_CMD";
3448f512ceSopenharmony_cistatic std::string TEST_OPTION_BRIEF = " TEST_BRIEF\n";
3548f512ceSopenharmony_cistatic std::string TEST_OPTION_HELP = " TEST_HELP\n";
3648f512ceSopenharmony_ci
3748f512ceSopenharmony_cistatic std::string OPTION_NAME = "--debug";
3848f512ceSopenharmony_cistatic std::string OPTION_ERROR_NAME = "--nodebug";
3948f512ceSopenharmony_cistatic std::string OPTION_NAME_ONLY = "--nameonly";
4048f512ceSopenharmony_cistatic std::string OPTION_NAME_VOID = "--void";
4148f512ceSopenharmony_cistatic std::string OPTION_ILLEGAL_NAME = "illegal";
4248f512ceSopenharmony_cistatic std::string OPTION_STRING_VALUE = "3";
4348f512ceSopenharmony_cistatic std::string OPTION_STRING_THREE_VALUES = "1,2,3";
4448f512ceSopenharmony_cistatic std::string OPTION_STRING_THREE_ILLEGAL_VALUES = "1,a,3";
4548f512ceSopenharmony_cistatic std::string OPTION_ERROR_VALUE = "4";
4648f512ceSopenharmony_cistatic const std::string OPTION_ILLEGAL_INT = "illegal_int";
4748f512ceSopenharmony_cistatic const int OPTION_INT_VALUE = std::stoi(OPTION_STRING_VALUE);
4848f512ceSopenharmony_ci
4948f512ceSopenharmony_cistatic const std::vector<std::string> ONE_ARGS = {OPTION_NAME};
5048f512ceSopenharmony_cistatic const std::vector<std::string> ONE_ARGS_WITH_VALUE = {OPTION_NAME, OPTION_STRING_VALUE};
5148f512ceSopenharmony_ci
5248f512ceSopenharmony_cistatic const std::vector<std::string> TWO_ARGS = {OPTION_NAME, OPTION_NAME};
5348f512ceSopenharmony_cistatic const std::vector<std::string> TWO_ARGS_WITH_VALUE = {
5448f512ceSopenharmony_ci    OPTION_NAME,
5548f512ceSopenharmony_ci    OPTION_STRING_VALUE,
5648f512ceSopenharmony_ci    OPTION_NAME,
5748f512ceSopenharmony_ci    OPTION_STRING_VALUE,
5848f512ceSopenharmony_ci};
5948f512ceSopenharmony_ci
6048f512ceSopenharmony_cistatic const std::vector<std::string> TWO_ERROR_ARGS = {OPTION_ERROR_NAME, OPTION_ERROR_NAME};
6148f512ceSopenharmony_cistatic const std::vector<std::string> TWO_ERROR_WITH_VALUE = {
6248f512ceSopenharmony_ci    OPTION_ERROR_NAME,
6348f512ceSopenharmony_ci    OPTION_STRING_VALUE,
6448f512ceSopenharmony_ci    OPTION_ERROR_NAME,
6548f512ceSopenharmony_ci    OPTION_STRING_VALUE,
6648f512ceSopenharmony_ci};
6748f512ceSopenharmony_ci
6848f512ceSopenharmony_cistatic const std::vector<std::string> MIX_ARGS_1 = {
6948f512ceSopenharmony_ci    OPTION_NAME,
7048f512ceSopenharmony_ci    OPTION_ERROR_NAME,
7148f512ceSopenharmony_ci};
7248f512ceSopenharmony_cistatic const std::vector<std::string> MIX_ARGS_1_WITH_VALUE = {
7348f512ceSopenharmony_ci    OPTION_NAME,
7448f512ceSopenharmony_ci    OPTION_STRING_VALUE,
7548f512ceSopenharmony_ci    OPTION_ERROR_NAME,
7648f512ceSopenharmony_ci    OPTION_STRING_VALUE,
7748f512ceSopenharmony_ci};
7848f512ceSopenharmony_cistatic const std::vector<std::string> MIX_ARGS_2 = {
7948f512ceSopenharmony_ci    OPTION_ERROR_NAME,
8048f512ceSopenharmony_ci    OPTION_NAME,
8148f512ceSopenharmony_ci};
8248f512ceSopenharmony_cistatic const std::vector<std::string> MIX_ARGS_2_WITH_VALUE = {
8348f512ceSopenharmony_ci    OPTION_ERROR_NAME,
8448f512ceSopenharmony_ci    OPTION_STRING_VALUE,
8548f512ceSopenharmony_ci    OPTION_NAME,
8648f512ceSopenharmony_ci    OPTION_STRING_VALUE,
8748f512ceSopenharmony_ci};
8848f512ceSopenharmony_ci
8948f512ceSopenharmony_cistatic const std::vector<std::string> MIX_ARGS_2_WITH_ILLEGAL_VALUE = {
9048f512ceSopenharmony_ci    OPTION_ERROR_NAME,
9148f512ceSopenharmony_ci    OPTION_ILLEGAL_INT,
9248f512ceSopenharmony_ci    OPTION_NAME,
9348f512ceSopenharmony_ci    OPTION_ILLEGAL_INT,
9448f512ceSopenharmony_ci};
9548f512ceSopenharmony_ci
9648f512ceSopenharmony_cistatic bool OptionAlwaysFalse(const std::vector<std::string> &args)
9748f512ceSopenharmony_ci{
9848f512ceSopenharmony_ci    printf("'%s'\n", __FUNCTION__);
9948f512ceSopenharmony_ci    return false;
10048f512ceSopenharmony_ci}
10148f512ceSopenharmony_cistatic bool OptionAlwaysTrue(const std::vector<std::string> &args)
10248f512ceSopenharmony_ci{
10348f512ceSopenharmony_ci    return true;
10448f512ceSopenharmony_ci}
10548f512ceSopenharmony_ci} // namespace HiPerf
10648f512ceSopenharmony_ci} // namespace Developtools
10748f512ceSopenharmony_ci} // namespace OHOS
10848f512ceSopenharmony_ci#endif // HIPERF_OPTION_TEST_H