1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "contiguous_data.h"
#include "ut_helpers.h"
#include "rope.h"
#include <library/cpp/testing/unittest/registar.h>
#include <util/random/random.h>
Y_UNIT_TEST_SUITE(TContiguousData) {
Y_UNIT_TEST(TypeSize) {
UNIT_ASSERT_EQUAL(sizeof(TContiguousData), 4 * sizeof(uintptr_t));
}
Y_UNIT_TEST(CrossCompare) {
TString str = "some very long string";
const TString constStr(str);
TStringBuf strbuf = str;
const TStringBuf constStrbuf = str;
TContiguousSpan span(str);
const TContiguousSpan constSpan(str);
TMutableContiguousSpan mutableSpan(const_cast<char*>(str.data()), str.size());
const TMutableContiguousSpan constMutableSpan(const_cast<char*>(str.data()), str.size());
TContiguousData data(str);
const TContiguousData constData(str);
TArrayRef<char> arrRef(const_cast<char*>(str.data()), str.size());
const TArrayRef<char> constArrRef(const_cast<char*>(str.data()), str.size());
TArrayRef<const char> arrConstRef(const_cast<char*>(str.data()), str.size());
const TArrayRef<const char> constArrConstRef(const_cast<char*>(str.data()), str.size());
NActors::TSharedData sharedData = NActors::TSharedData::Copy(str.data(), str.size());
const NActors::TSharedData constSharedData(sharedData);
Permutate(
[](auto& arg1, auto& arg2) {
UNIT_ASSERT(arg1 == arg2);
},
str,
constStr,
strbuf,
constStrbuf,
span,
constSpan,
mutableSpan,
constMutableSpan,
data,
constData,
arrRef,
constArrRef,
arrConstRef,
constArrConstRef,
sharedData,
constSharedData);
}
}
|