• 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 <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/IFoo.h>
26 #include <aidl/hidl2aidl/test/OnlyIn10.h>
27 #include <aidl/hidl2aidl/test/OnlyIn11.h>
28 #include <aidl/hidl2aidl/test/Outer.h>
29 #include <aidl/hidl2aidl/test/OverrideMe.h>
30 #include <aidl/hidl2aidl/test/Value.h>
31 #include <aidl/hidl2aidl/test2/BnFoo.h>
32 #include <aidl/hidl2aidl/test2/BpFoo.h>
33 #include <aidl/hidl2aidl/test2/IFoo.h>
34 
testIFoo(const std::shared_ptr<aidl::hidl2aidl::test::IFoo> & foo)35 void testIFoo(const std::shared_ptr<aidl::hidl2aidl::test::IFoo>& foo) {
36     ndk::ScopedAStatus status1 = foo->someBar(std::string(), std::string());
37     (void)status1;
38     std::string f;
39     ndk::ScopedAStatus status2 = foo->oneOutput(&f);
40     (void)status2;
41 }
42 
testIBar(const std::shared_ptr<aidl::hidl2aidl::test::IBar> & bar)43 void testIBar(const std::shared_ptr<aidl::hidl2aidl::test::IBar>& bar) {
44     std::string out;
45     ndk::ScopedAStatus status1 = bar->someBar(std::string(), 3, &out);
46     (void)status1;
47     aidl::hidl2aidl::test::IBar::Inner inner;
48     inner.a = 3;
49     ndk::ScopedAStatus status2 = bar->extraMethod(inner);
50     (void)status2;
51 }
52 
53 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::A) == 3);
54 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::B) == 7);
55 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::C) == 8);
56 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::D) == 9);
57 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::E) == 27);
58 static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::F) == 28);
59 
testIFoo2(const std::shared_ptr<aidl::hidl2aidl::test2::IFoo> & foo)60 void testIFoo2(const std::shared_ptr<aidl::hidl2aidl::test2::IFoo>& foo) {
61     ndk::ScopedAStatus status = foo->someFoo(3);
62     (void)status;
63 }
64