• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <hidl2aidl/BnBar.h>
21 #include <hidl2aidl/BnFoo.h>
22 #include <hidl2aidl/BpBar.h>
23 #include <hidl2aidl/BpFoo.h>
24 #include <hidl2aidl/IBar.h>
25 #include <hidl2aidl/IBarInner.h>
26 #include <hidl2aidl/IFoo.h>
27 #include <hidl2aidl/IFooBigStruct.h>
28 #include <hidl2aidl/OnlyIn10.h>
29 #include <hidl2aidl/OnlyIn11.h>
30 #include <hidl2aidl/Outer.h>
31 #include <hidl2aidl/OuterInner.h>
32 #include <hidl2aidl/OverrideMe.h>
33 #include <hidl2aidl/Value.h>
34 #include <hidl2aidl2/BnFoo.h>
35 #include <hidl2aidl2/BpFoo.h>
36 #include <hidl2aidl2/IFoo.h>
37 
38 using android::sp;
39 using android::String16;
40 using android::binder::Status;
41 
testIFoo(const sp<hidl2aidl::IFoo> & foo)42 void testIFoo(const sp<hidl2aidl::IFoo>& foo) {
43     Status status1 = foo->someBar(String16());
44     (void)status1;
45     String16 f;
46     Status status2 = foo->oneOutput(&f);
47     (void)status2;
48 }
49 
testIBar(const sp<hidl2aidl::IBar> & bar)50 void testIBar(const sp<hidl2aidl::IBar>& bar) {
51     String16 out;
52     Status status1 = bar->someBar(String16(), 3, &out);
53     (void)status1;
54     hidl2aidl::IBarInner inner;
55     inner.a = 3;
56     Status status2 = bar->extraMethod(inner);
57     (void)status2;
58 }
59 
60 static_assert(static_cast<int>(hidl2aidl::Value::A) == 3);
61 static_assert(static_cast<int>(hidl2aidl::Value::B) == 7);
62 static_assert(static_cast<int>(hidl2aidl::Value::C) == 8);
63 static_assert(static_cast<int>(hidl2aidl::Value::D) == 9);
64 static_assert(static_cast<int>(hidl2aidl::Value::E) == 27);
65 static_assert(static_cast<int>(hidl2aidl::Value::F) == 28);
66 
testIFoo2(const sp<hidl2aidl2::IFoo> & foo)67 void testIFoo2(const sp<hidl2aidl2::IFoo>& foo) {
68     Status status = foo->someFoo(3);
69     (void)status;
70 }
71