1 /*
2  * Copyright (C) 2019 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 // This is a compilation test only, to see that types are generated as
18 // expected.
19 
20 #include <aidl/hidl2aidl/BnBar.h>
21 #include <aidl/hidl2aidl/BnFoo.h>
22 #include <aidl/hidl2aidl/BpBar.h>
23 #include <aidl/hidl2aidl/BpFoo.h>
24 #include <aidl/hidl2aidl/IBar.h>
25 #include <aidl/hidl2aidl/IBarInner.h>
26 #include <aidl/hidl2aidl/IFoo.h>
27 #include <aidl/hidl2aidl/IFooBigStruct.h>
28 #include <aidl/hidl2aidl/OnlyIn10.h>
29 #include <aidl/hidl2aidl/OnlyIn11.h>
30 #include <aidl/hidl2aidl/Outer.h>
31 #include <aidl/hidl2aidl/OuterInner.h>
32 #include <aidl/hidl2aidl/OverrideMe.h>
33 #include <aidl/hidl2aidl/Value.h>
34 #include <aidl/hidl2aidl2/BnFoo.h>
35 #include <aidl/hidl2aidl2/BpFoo.h>
36 #include <aidl/hidl2aidl2/IFoo.h>
37 
testIFoo(const std::shared_ptr<aidl::hidl2aidl::IFoo> & foo)38 void testIFoo(const std::shared_ptr<aidl::hidl2aidl::IFoo>& foo) {
39     ndk::ScopedAStatus status1 = foo->someBar(std::string(), std::string());
40     (void)status1;
41     std::string f;
42     ndk::ScopedAStatus status2 = foo->oneOutput(&f);
43     (void)status2;
44 }
45 
testIBar(const std::shared_ptr<aidl::hidl2aidl::IBar> & bar)46 void testIBar(const std::shared_ptr<aidl::hidl2aidl::IBar>& bar) {
47     std::string out;
48     ndk::ScopedAStatus status1 = bar->someBar(std::string(), 3, &out);
49     (void)status1;
50     aidl::hidl2aidl::IBarInner inner;
51     inner.a = 3;
52     ndk::ScopedAStatus status2 = bar->extraMethod(inner);
53     (void)status2;
54 }
55 
56 static_assert(static_cast<int>(aidl::hidl2aidl::Value::A) == 3);
57 static_assert(static_cast<int>(aidl::hidl2aidl::Value::B) == 7);
58 static_assert(static_cast<int>(aidl::hidl2aidl::Value::C) == 8);
59 static_assert(static_cast<int>(aidl::hidl2aidl::Value::D) == 9);
60 static_assert(static_cast<int>(aidl::hidl2aidl::Value::E) == 27);
61 static_assert(static_cast<int>(aidl::hidl2aidl::Value::F) == 28);
62 
testIFoo2(const std::shared_ptr<aidl::hidl2aidl2::IFoo> & foo)63 void testIFoo2(const std::shared_ptr<aidl::hidl2aidl2::IFoo>& foo) {
64     ndk::ScopedAStatus status = foo->someFoo(3);
65     (void)status;
66 }
67