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/test/BnBar.h>
21 #include <aidl/hidl2aidl/test/BnFoo.h>
22 #include <aidl/hidl2aidl/test/BpBar.h>
23 #include <aidl/hidl2aidl/test/BpFoo.h>
24 #include <aidl/hidl2aidl/test/IBar.h>
25 #include <aidl/hidl2aidl/test/IBarInner.h>
26 #include <aidl/hidl2aidl/test/IFoo.h>
27 #include <aidl/hidl2aidl/test/IFooBigStruct.h>
28 #include <aidl/hidl2aidl/test/OnlyIn10.h>
29 #include <aidl/hidl2aidl/test/OnlyIn11.h>
30 #include <aidl/hidl2aidl/test/Outer.h>
31 #include <aidl/hidl2aidl/test/OuterInner.h>
32 #include <aidl/hidl2aidl/test/OverrideMe.h>
33 #include <aidl/hidl2aidl/test/Value.h>
34 #include <aidl/hidl2aidl/test2/BnFoo.h>
35 #include <aidl/hidl2aidl/test2/BpFoo.h>
36 #include <aidl/hidl2aidl/test2/IFoo.h>
37 
testIFoo(const std::shared_ptr<aidl::hidl2aidl::test::IFoo> & foo)38 void testIFoo(const std::shared_ptr<aidl::hidl2aidl::test::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::test::IBar> & bar)46 void testIBar(const std::shared_ptr<aidl::hidl2aidl::test::IBar>& bar) {
47     std::string out;
48     ndk::ScopedAStatus status1 = bar->someBar(std::string(), 3, &out);
49     (void)status1;
50     aidl::hidl2aidl::test::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::test::Value::A) == 3);
57 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::B) == 7);
58 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::C) == 8);
59 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::D) == 9);
60 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::E) == 27);
61 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::F) == 28);
62 
testIFoo2(const std::shared_ptr<aidl::hidl2aidl::test2::IFoo> & foo)63 void testIFoo2(const std::shared_ptr<aidl::hidl2aidl::test2::IFoo>& foo) {
64     ndk::ScopedAStatus status = foo->someFoo(3);
65     (void)status;
66 }
67