1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Tests for using imported types.
16
17 #include <stdint.h>
18
19 #include <vector>
20
21 #include "gtest/gtest.h"
22 #include "testdata/importer.emb.h"
23
24 namespace emboss {
25 namespace test {
26 namespace {
27
28 const ::std::uint8_t kOuter[16] = {
29 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // inner
30 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // inner_gen
31 };
32
TEST(Importer,CanAccessInner)33 TEST(Importer, CanAccessInner) {
34 auto view = OuterView(kOuter, sizeof kOuter);
35 EXPECT_EQ(0x0807060504030201UL, view.inner().value().Read());
36 EXPECT_EQ(0x100f0e0d0c0b0a09UL, view.inner_gen().value().Read());
37 }
38
39 } // namespace
40 } // namespace test
41 } // namespace emboss
42