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)12TEST(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