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 #include "gmock/gmock-matchers.h"
17 #include "gmock/gmock.h"
18 #include "gtest/gtest.h"
19 #include "prebuilt_interface.h"
20 #include "types/Status.h"
21
22 namespace android {
23 namespace automotive {
24 namespace computepipe {
25 namespace graph {
26 namespace {
27
TEST(EnumConversionTest,StatusToErrorCodeEnums)28 TEST(EnumConversionTest, StatusToErrorCodeEnums) {
29 EXPECT_EQ(static_cast<int>(PrebuiltComputepipeRunner_ErrorCode::SUCCESS),
30 static_cast<int>(Status::SUCCESS));
31 EXPECT_EQ(static_cast<int>(PrebuiltComputepipeRunner_ErrorCode::INTERNAL_ERROR),
32 static_cast<int>(Status::INTERNAL_ERROR));
33 EXPECT_EQ(PrebuiltComputepipeRunner_ErrorCode::INVALID_ARGUMENT,
34 static_cast<int>(Status::INVALID_ARGUMENT));
35 EXPECT_EQ(PrebuiltComputepipeRunner_ErrorCode::ILLEGAL_STATE,
36 static_cast<int>(Status::ILLEGAL_STATE));
37 EXPECT_EQ(PrebuiltComputepipeRunner_ErrorCode::NO_MEMORY, static_cast<int>(Status::NO_MEMORY));
38 EXPECT_EQ(PrebuiltComputepipeRunner_ErrorCode::FATAL_ERROR,
39 static_cast<int>(Status::FATAL_ERROR));
40 EXPECT_EQ(PrebuiltComputepipeRunner_ErrorCode::ERROR_CODE_MAX,
41 static_cast<int>(Status::STATUS_MAX));
42 }
43 enum PrebuiltComputepipeRunner_PixelDataFormat {
44 RGB = 0,
45 RGBA = 1,
46 GRAY = 2,
47 PIXEL_DATA_FORMAT_MAX = 3,
48 };
TEST(EnumConversionTest,PixelFormatEnums)49 TEST(EnumConversionTest, PixelFormatEnums) {
50 EXPECT_EQ(static_cast<int>(PrebuiltComputepipeRunner_PixelDataFormat::RGB),
51 static_cast<int>(PixelFormat::RGB));
52 EXPECT_EQ(static_cast<int>(PrebuiltComputepipeRunner_PixelDataFormat::RGBA),
53 static_cast<int>(PixelFormat::RGBA));
54 EXPECT_EQ(PrebuiltComputepipeRunner_PixelDataFormat::GRAY, static_cast<int>(PixelFormat::GRAY));
55 EXPECT_EQ(PrebuiltComputepipeRunner_PixelDataFormat::PIXEL_DATA_FORMAT_MAX,
56 static_cast<int>(PixelFormat::PIXELFORMAT_MAX));
57 }
58
59 } // namespace
60 } // namespace graph
61 } // namespace computepipe
62 } // namespace automotive
63 } // namespace android
64