xref: /aosp_15_r20/external/cronet/base/containers/span_rust_unittest.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/containers/span_rust.h"
6 
7 #include "testing/gtest/include/gtest/gtest.h"
8 
9 namespace base {
10 namespace {
11 
TEST(BaseSpanRustTest,SliceConstruct)12 TEST(BaseSpanRustTest, SliceConstruct) {
13   uint8_t data[] = {0, 1, 2, 3, 4};
14   span<const uint8_t> data_span(data, 2u);
15   rust::Slice<const uint8_t> rust_slice = SpanToRustSlice(data_span);
16   EXPECT_EQ(2ul, rust_slice.length());
17   EXPECT_EQ(1, rust_slice[1]);
18 }
19 
20 }  // namespace
21 }  // namespace base
22