20#include <xrpl/basics/Slice.h>
21#include <xrpl/beast/unit_test.h>
35 0xa8, 0xa1, 0x38, 0x45, 0x23, 0xec, 0xe4, 0x23, 0x71, 0x6d, 0x2a,
36 0x18, 0xb4, 0x70, 0xcb, 0xf5, 0xac, 0x2d, 0x89, 0x4d, 0x19, 0x9c,
37 0xf0, 0x2c, 0x15, 0xd1, 0xf9, 0x9b, 0x66, 0xd2, 0x30, 0xd3};
44 BEAST_EXPECT(s0.size() == 0);
45 BEAST_EXPECT(s0.data() ==
nullptr);
46 BEAST_EXPECT(s0 == s0);
51 Slice const s1{data, i};
53 BEAST_EXPECT(s1.size() == i);
54 BEAST_EXPECT(s1.data() !=
nullptr);
57 BEAST_EXPECT(s1 == s0);
59 BEAST_EXPECT(s1 != s0);
63 Slice const s2{data, j};
66 BEAST_EXPECT(s1 == s2);
68 BEAST_EXPECT(s1 != s2);
77 a[i] = b[i] = data[i];
89 Slice const s{data,
sizeof(data)};
92 BEAST_EXPECT(s[i] == data[i]);
102 Slice s(data + i,
sizeof(data) - i);
105 BEAST_EXPECT(s.
data() == data + i + j);
106 BEAST_EXPECT(s.
size() ==
sizeof(data) - i - j);
testcase_t testcase
Memberspace for declaring test cases.
An immutable linear range of bytes.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
std::size_t size() const noexcept
Returns the number of bytes in the storage.
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)
void run() override
Runs the suite.