1 // 2 // Copyright (C) 2022 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 #pragma once 17 18 #include <optional> 19 #include <string> 20 #include <vector> 21 22 #include <gtest/gtest.h> 23 24 #include "host/commands/cvd/selector/arguments_lexer.h" 25 26 namespace cuttlefish { 27 namespace selector { 28 29 using Tokens = std::vector<ArgToken>; 30 31 struct LexerInputOutput { 32 LexerFlagsSpecification known_flags_; 33 std::string lex_input_; 34 std::optional<Tokens> expected_tokens_; 35 }; 36 37 class LexerTestBase : public testing::TestWithParam<LexerInputOutput> { 38 protected: 39 LexerTestBase(); 40 void Init(); 41 42 LexerFlagsSpecification known_flags_; 43 std::string lex_input_; 44 std::optional<Tokens> expected_tokens_; 45 }; 46 47 class EmptyArgsLexTest : public LexerTestBase {}; 48 class NonBooleanArgsTest : public LexerTestBase {}; 49 class BooleanArgsTest : public LexerTestBase {}; 50 class BothArgsTest : public LexerTestBase {}; 51 52 class BooleanBadArgsTest : public LexerTestBase {}; 53 54 } // namespace selector 55 } // namespace cuttlefish 56