1#include <xrpl/basics/Slice.h>
3#include <gtest/gtest.h>
10static std::uint8_t const data[] = {0xa8, 0xa1, 0x38, 0x45, 0x23, 0xec, 0xe4, 0x23, 0x71, 0x6d, 0x2a,
11 0x18, 0xb4, 0x70, 0xcb, 0xf5, 0xac, 0x2d, 0x89, 0x4d, 0x19, 0x9c,
12 0xf0, 0x2c, 0x15, 0xd1, 0xf9, 0x9b, 0x66, 0xd2, 0x30, 0xd3};
14TEST(
Slice, equality_and_inequality)
18 EXPECT_EQ(s0.size(), 0);
19 EXPECT_EQ(s0.data(),
nullptr);
27 EXPECT_EQ(s1.size(), i);
28 EXPECT_NE(s1.data(),
nullptr);
51 a[i] = b[i] = data[i];
65 EXPECT_EQ(s[i], data[i]);
74 Slice s(data + i,
sizeof(data) - i);
77 EXPECT_EQ(s.data(), data + i + j);
78 EXPECT_EQ(s.size(),
sizeof(data) - i - j);
An immutable linear range of bytes.
auto const data
General field definitions, or fields used in multiple transaction namespaces.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)