• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <unordered_map>
21 #include <vector>
22 
23 #include <gtest/gtest.h>
24 
25 #include "host/commands/cvd/types.h"
26 
27 namespace cuttlefish {
28 namespace selector {
29 
30 struct InstanceIdTestInput {
31   std::string cmd_args;
32   std::string selector_args;
33   std::optional<std::string> cuttlefish_instance;
34   std::optional<std::vector<unsigned>> expected_ids;
35   unsigned requested_num_instances;
36   bool expected_result;
37 };
38 
39 class InstanceIdTest : public testing::TestWithParam<InstanceIdTestInput> {
40  protected:
41   InstanceIdTest();
42 
43   bool expected_result_;
44   unsigned requested_num_instances_;
45   std::optional<std::vector<unsigned>> expected_ids_;
46   uid_t uid_;
47   cvd_common::Args cmd_args_;
48   cvd_common::Args selector_args_;
49   cvd_common::Envs envs_;
50 };
51 
52 }  // namespace selector
53 }  // namespace cuttlefish
54