blob: 5397436bf484515a43987d7572bcf68168a26d31 [file] [log] [blame]
Kevin Rocardf0357882017-02-10 16:19:28 -08001/*
2 * Copyright (C) 2017 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 <hidl/Status.h>
17
18namespace detail {
19
20inline void assertOk(::android::hardware::Return<void> ret) {
21 ASSERT_TRUE(ret.isOk());
22}
23
24inline void assertOk(::android::hardware::audio::V2_0::Result result) {
25 ASSERT_EQ(decltype(result)::OK, result);
26}
27
28inline void assertOk(::android::hardware::Return<::android::hardware::audio::V2_0::Result> ret) {
29 ASSERT_TRUE(ret.isOk());
30 ::android::hardware::audio::V2_0::Result result = ret;
31 assertOk(result);
32}
33
34}
35
36// Test anything provided is and contains only OK
37#define ASSERT_OK(ret) ASSERT_NO_FATAL_FAILURE(detail::assertOk(ret))
38#define EXPECT_OK(ret) EXPECT_NO_FATAL_FAILURE(detail::assertOk(ret))