1 /*
2 * Copyright 2020 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
17 #include "shim/dumpsys_args.h"
18 #include "shim/dumpsys.h"
19
20 #include <gtest/gtest.h>
21
22 using namespace bluetooth;
23
24 namespace testing {
25
TEST(DumpsysArgsTest,no_args)26 TEST(DumpsysArgsTest, no_args) {
27 shim::ParsedDumpsysArgs parsed_dumpsys_args(nullptr);
28 ASSERT_FALSE(parsed_dumpsys_args.IsDeveloper());
29 }
30
TEST(DumpsysArgsTest,parsed_args_without_dev)31 TEST(DumpsysArgsTest, parsed_args_without_dev) {
32 const char* args[]{
33 nullptr,
34 };
35 shim::ParsedDumpsysArgs parsed_dumpsys_args(args);
36 ASSERT_FALSE(parsed_dumpsys_args.IsDeveloper());
37 }
38
TEST(DumpsysArgsTest,parsed_args_with_dev)39 TEST(DumpsysArgsTest, parsed_args_with_dev) {
40 const char* args[]{
41 bluetooth::shim::kArgumentDeveloper,
42 nullptr,
43 };
44 shim::ParsedDumpsysArgs parsed_dumpsys_args(args);
45 ASSERT_TRUE(parsed_dumpsys_args.IsDeveloper());
46 }
47
48 } // namespace testing
49