line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "test.h" |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
using Test = TestSv; |
4
|
|
|
|
|
|
|
|
5
|
124
|
|
|
|
|
|
TEST_CASE("Hash", "[Sv]") { |
6
|
180
|
50
|
|
|
|
|
perlvars vars; |
7
|
180
|
50
|
|
|
|
|
Hash my(vars.hv); |
8
|
180
|
|
|
|
|
|
Sv oth_valid(vars.ohv), oth_invalid(vars.av); |
9
|
|
|
|
|
|
|
|
10
|
124
|
50
|
|
|
|
|
SECTION("ctor") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
11
|
35
|
50
|
|
|
|
|
SECTION("empty") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
12
|
2
|
|
|
|
|
|
Hash o; |
13
|
1
|
50
|
|
|
|
|
REQUIRE(!o); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
14
|
|
|
|
|
|
|
} |
15
|
58
|
50
|
|
|
|
|
SECTION("from SV") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
16
|
24
|
50
|
|
|
|
|
SECTION("from undef SV") { Test::ctor(vars.undef, behaviour_t::EMPTY); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
17
|
24
|
50
|
|
|
|
|
SECTION("from number SV") { Test::ctor(vars.iv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
18
|
24
|
50
|
|
|
|
|
SECTION("from string SV") { Test::ctor(vars.pv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
19
|
24
|
50
|
|
|
|
|
SECTION("from RV") { Test::ctor(vars.rv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
20
|
24
|
50
|
|
|
|
|
SECTION("from RV-OAV") { Test::ctor(vars.oavr, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
21
|
24
|
50
|
|
|
|
|
SECTION("from RV-OHV") { Test::ctor(vars.ohvr, behaviour_t::VALID, (SV*)vars.ohv); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
22
|
24
|
50
|
|
|
|
|
SECTION("from AV") { Test::ctor((SV*)vars.av, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
24
|
50
|
|
|
|
|
SECTION("from HV") { Test::ctor((SV*)vars.hv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
24
|
24
|
50
|
|
|
|
|
SECTION("from SHV") { Test::ctor((SV*)vars.stash, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
24
|
50
|
|
|
|
|
SECTION("from OHV") { Test::ctor((SV*)vars.ohv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
26
|
24
|
50
|
|
|
|
|
SECTION("from CV") { Test::ctor((SV*)vars.cv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
27
|
24
|
50
|
|
|
|
|
SECTION("from IO") { Test::ctor((SV*)vars.io, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
34
|
50
|
|
|
|
|
SECTION("from HV") { Test::ctor(vars.hv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
34
|
50
|
|
|
|
|
SECTION("from Hash") { Test::ctor(my, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
32
|
34
|
50
|
|
|
|
|
SECTION("from valid Sv") { Test::ctor(oth_valid, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
33
|
34
|
50
|
|
|
|
|
SECTION("from invalid Sv") { Test::ctor(oth_invalid, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
34
|
35
|
50
|
|
|
|
|
SECTION("from ilist") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Hash o({ |
36
|
|
|
|
|
|
|
{"key1", Simple(1)}, |
37
|
|
|
|
|
|
|
{"key2", Simple("val2")}, |
38
|
4
|
50
|
|
|
|
|
}); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key1"]) == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key2"]) == "val2"); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
93
|
50
|
|
|
|
|
SECTION("create") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
46
|
4
|
50
|
|
|
|
|
SECTION("empty") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
47
|
2
|
50
|
|
|
|
|
auto o = Hash::create(); |
48
|
1
|
50
|
|
|
|
|
REQUIRE(o); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
|
REQUIRE(o.get()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
4
|
50
|
|
|
|
|
SECTION("ilist") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
52
|
|
|
|
|
|
|
auto o = Hash::create({ |
53
|
|
|
|
|
|
|
{"key1", Simple(1)}, |
54
|
|
|
|
|
|
|
{"key2", Simple("val2")}, |
55
|
4
|
50
|
|
|
|
|
}); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
57
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key1"]) == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
58
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key2"]) == "val2"); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
4
|
50
|
|
|
|
|
SECTION("with capacity") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
61
|
2
|
50
|
|
|
|
|
auto o = Hash::create(50); |
62
|
1
|
50
|
|
|
|
|
REQUIRE(o.capacity() >= 50); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
128
|
50
|
|
|
|
|
SECTION("operator=") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
67
|
76
|
50
|
|
|
|
|
auto o = Hash::create(); |
68
|
62
|
50
|
|
|
|
|
SECTION("SV") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
69
|
24
|
50
|
|
|
|
|
SECTION("undef SV") { Test::assign(o, vars.undef, behaviour_t::EMPTY); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
70
|
24
|
50
|
|
|
|
|
SECTION("number SV") { Test::assign(o, vars.iv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
71
|
24
|
50
|
|
|
|
|
SECTION("string SV") { Test::assign(o, vars.pv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
72
|
24
|
50
|
|
|
|
|
SECTION("RV") { Test::assign(o, vars.rv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
73
|
24
|
50
|
|
|
|
|
SECTION("RV-OAV") { Test::assign(o, vars.oavr, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
74
|
24
|
50
|
|
|
|
|
SECTION("RV-OHV") { Test::assign(o, vars.ohvr, behaviour_t::VALID, (SV*)vars.ohv); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
75
|
24
|
50
|
|
|
|
|
SECTION("AV") { Test::assign(o, (SV*)vars.av, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
76
|
24
|
50
|
|
|
|
|
SECTION("HV") { Test::assign(o, (SV*)vars.hv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
77
|
24
|
50
|
|
|
|
|
SECTION("SHV") { Test::assign(o, (SV*)vars.stash, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
78
|
24
|
50
|
|
|
|
|
SECTION("OHV") { Test::assign(o, (SV*)vars.ohv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
79
|
24
|
50
|
|
|
|
|
SECTION("CV") { Test::assign(o, (SV*)vars.cv, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
80
|
24
|
50
|
|
|
|
|
SECTION("IO") { Test::assign(o, (SV*)vars.io, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
38
|
50
|
|
|
|
|
SECTION("HV") { Test::assign(o, vars.hv, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
83
|
38
|
50
|
|
|
|
|
SECTION("Hash") { Test::assign(o, my, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
84
|
38
|
50
|
|
|
|
|
SECTION("valid Sv") { Test::assign(o, oth_valid, behaviour_t::VALID); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
85
|
38
|
50
|
|
|
|
|
SECTION("invalid Sv") { Test::assign(o, oth_invalid, behaviour_t::THROWS); } |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
91
|
50
|
|
|
|
|
SECTION("set") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
89
|
2
|
|
|
|
|
|
Hash o; |
90
|
1
|
50
|
|
|
|
|
o.set(vars.iv); // no checks |
91
|
1
|
50
|
|
|
|
|
REQUIRE(o); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
92
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
93
|
1
|
50
|
|
|
|
|
REQUIRE(o.get() == vars.iv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
92
|
50
|
|
|
|
|
SECTION("cast") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
97
|
4
|
50
|
|
|
|
|
Hash o(vars.hv); |
98
|
2
|
|
|
|
|
|
auto rcnt = SvREFCNT(vars.hv); |
99
|
3
|
50
|
|
|
|
|
SECTION("to SV") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
100
|
1
|
|
|
|
|
|
SV* sv = o; |
101
|
1
|
50
|
|
|
|
|
REQUIRE(sv == (SV*)vars.hv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
102
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.hv) == rcnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
104
|
3
|
50
|
|
|
|
|
SECTION("to HV") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
105
|
1
|
|
|
|
|
|
HV* sv = o; |
106
|
1
|
50
|
|
|
|
|
REQUIRE(sv == vars.hv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
107
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.hv) == rcnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
91
|
50
|
|
|
|
|
SECTION("get") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
112
|
2
|
50
|
|
|
|
|
Hash o(vars.hv); |
113
|
1
|
|
|
|
|
|
auto rcnt = SvREFCNT(vars.hv); |
114
|
1
|
50
|
|
|
|
|
REQUIRE(o.get<>() == (SV*)vars.hv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
115
|
1
|
50
|
|
|
|
|
REQUIRE(o.get() == (SV*)vars.hv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
116
|
1
|
50
|
|
|
|
|
REQUIRE(o.get() == vars.hv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
117
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.hv) == rcnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
91
|
50
|
|
|
|
|
SECTION("fetch/[]const/[]/at") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
121
|
2
|
|
|
|
|
|
Hash o; |
122
|
1
|
|
|
|
|
|
const Hash& co = o; |
123
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("key")); // fetch return empty object when empty |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
124
|
1
|
50
|
|
|
|
|
REQUIRE(!co["key"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
125
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
126
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o.at("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
129
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
130
|
1
|
50
|
|
|
|
|
REQUIRE(!co["key"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
131
|
1
|
50
|
|
|
|
|
REQUIRE(o["key"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
132
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
133
|
1
|
50
|
|
|
|
|
REQUIRE(o.at("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
134
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o.at("nokey")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
1
|
50
|
|
|
|
|
hv_stores(o, "key", newSViv(10)); |
|
|
50
|
|
|
|
|
|
137
|
1
|
50
|
|
|
|
|
hv_stores(o, "name", newSVpvs("vasya")); |
|
|
50
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
140
|
1
|
50
|
|
|
|
|
REQUIRE(o.at("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
141
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o.fetch("key")).get() == 10); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o.at("key")).get() == 10); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
143
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(co["name"]) == "vasya"); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
144
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["name"]) == "vasya"); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
145
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("nokey")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
146
|
1
|
50
|
|
|
|
|
REQUIRE(!co["nokey"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
147
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o.at("nokey")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
148
|
1
|
50
|
|
|
|
|
REQUIRE(o["nokey"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
149
|
1
|
50
|
|
|
|
|
REQUIRE(co["nokey"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
150
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("nokey")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
91
|
50
|
|
|
|
|
SECTION("store/[]=") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
154
|
2
|
|
|
|
|
|
Hash o; |
155
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o.store("key", Sv())); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
156
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
159
|
1
|
|
|
|
|
|
auto pcnt = SvREFCNT(vars.pv); |
160
|
1
|
50
|
|
|
|
|
o.store("key", vars.pv); |
161
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o.fetch("key")) == "hello"); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
162
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.pv) == pcnt+1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
1
|
|
|
|
|
|
auto icnt = SvREFCNT(vars.iv); |
165
|
1
|
50
|
|
|
|
|
o["age"] = vars.iv; |
|
|
50
|
|
|
|
|
|
166
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("age").get() == vars.iv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
167
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt+1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
1
|
|
|
|
|
|
auto rcnt = SvREFCNT(vars.rv); |
170
|
1
|
50
|
|
|
|
|
o.store("key", vars.rv); |
171
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("key").get() == vars.rv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
172
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.pv) == pcnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
173
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.rv) == rcnt+1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
1
|
50
|
|
|
|
|
o["age"] = vars.rv; |
|
|
50
|
|
|
|
|
|
176
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("age").get() == vars.rv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
177
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
178
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.rv) == rcnt+2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
1
|
50
|
|
|
|
|
o.store("undef", nullptr); |
181
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("undef")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
182
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("undef").defined()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
183
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("undef").use_count() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
1
|
50
|
|
|
|
|
o["u"] = nullptr; |
|
|
50
|
|
|
|
|
|
186
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("u")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
187
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("u").defined()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
188
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("u").use_count() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
1
|
50
|
|
|
|
|
o["a"] = Simple(100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
191
|
1
|
50
|
|
|
|
|
o["b"] = o["a"]; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
192
|
1
|
50
|
|
|
|
|
REQUIRE(o.fetch("b")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
193
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o.fetch("b")) == 100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
1
|
50
|
|
|
|
|
o.store("c", o["b"]); |
|
|
50
|
|
|
|
|
|
196
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o.fetch("c")) == 100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
91
|
50
|
|
|
|
|
SECTION("erase") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
200
|
2
|
50
|
|
|
|
|
auto o = Hash::create(); |
201
|
1
|
50
|
|
|
|
|
REQUIRE(!o.erase("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
202
|
1
|
50
|
|
|
|
|
o["key"] = vars.pv; |
|
|
50
|
|
|
|
|
|
203
|
2
|
50
|
|
|
|
|
Sv elem = o.erase("key"); |
204
|
1
|
50
|
|
|
|
|
REQUIRE(elem); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
205
|
1
|
50
|
|
|
|
|
REQUIRE(elem.get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
206
|
1
|
50
|
|
|
|
|
REQUIRE(!o.fetch("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
207
|
1
|
50
|
|
|
|
|
elem.reset(); |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
91
|
50
|
|
|
|
|
SECTION("exists") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
211
|
2
|
|
|
|
|
|
Hash o; |
212
|
1
|
50
|
|
|
|
|
REQUIRE(!o.exists("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
213
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
214
|
1
|
50
|
|
|
|
|
REQUIRE(!o.exists("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
215
|
1
|
50
|
|
|
|
|
o["key"] = nullptr; |
|
|
50
|
|
|
|
|
|
216
|
1
|
50
|
|
|
|
|
REQUIRE(o.exists("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
217
|
1
|
50
|
|
|
|
|
o.erase("key"); |
218
|
1
|
50
|
|
|
|
|
REQUIRE(!o.contains("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
91
|
50
|
|
|
|
|
SECTION("size") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
222
|
2
|
|
|
|
|
|
Hash o; |
223
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
224
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
225
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
226
|
1
|
50
|
|
|
|
|
o["key"] = nullptr; |
|
|
50
|
|
|
|
|
|
227
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
228
|
1
|
50
|
|
|
|
|
o.store("key2", vars.pv); |
229
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
230
|
1
|
50
|
|
|
|
|
o["key2"] = vars.iv; |
|
|
50
|
|
|
|
|
|
231
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
91
|
50
|
|
|
|
|
SECTION("clear/undef") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
235
|
2
|
|
|
|
|
|
Hash o; |
236
|
1
|
50
|
|
|
|
|
o.clear(); |
237
|
1
|
50
|
|
|
|
|
o.undef(); |
238
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
239
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
240
|
1
|
50
|
|
|
|
|
o.clear(); |
241
|
1
|
50
|
|
|
|
|
o.undef(); |
242
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
243
|
|
|
|
|
|
|
|
244
|
1
|
50
|
|
|
|
|
o["key"] = vars.iv; |
|
|
50
|
|
|
|
|
|
245
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
246
|
1
|
50
|
|
|
|
|
o.clear(); |
247
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
248
|
1
|
50
|
|
|
|
|
REQUIRE(!o.exists("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
1
|
50
|
|
|
|
|
o["key"] = vars.pv; |
|
|
50
|
|
|
|
|
|
251
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
252
|
1
|
50
|
|
|
|
|
o.undef(); |
253
|
1
|
50
|
|
|
|
|
REQUIRE(o.size() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
254
|
1
|
50
|
|
|
|
|
REQUIRE(!o.exists("key")); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
91
|
50
|
|
|
|
|
SECTION("iterate") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
258
|
2
|
|
|
|
|
|
Hash o; |
259
|
1
|
50
|
|
|
|
|
REQUIRE(o.begin() == o.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
260
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
261
|
1
|
50
|
|
|
|
|
REQUIRE(o.begin() == o.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
262
|
1
|
|
|
|
|
|
auto icnt = SvREFCNT(vars.iv); |
263
|
1
|
|
|
|
|
|
auto pcnt = SvREFCNT(vars.pv); |
264
|
1
|
50
|
|
|
|
|
o["key"] = vars.iv; |
|
|
50
|
|
|
|
|
|
265
|
1
|
50
|
|
|
|
|
o["name"] = vars.pv; |
|
|
50
|
|
|
|
|
|
266
|
1
|
50
|
|
|
|
|
o["ref"] = vars.rv; |
|
|
50
|
|
|
|
|
|
267
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt+1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
2
|
50
|
|
|
|
|
Hash check = Hash::create(); |
270
|
1
|
|
|
|
|
|
int cnt = 0; |
271
|
4
|
50
|
|
|
|
|
for (auto it = o.begin(); it != o.end(); ++it) { |
|
|
100
|
|
|
|
|
|
272
|
3
|
|
|
|
|
|
cnt++; |
273
|
3
|
50
|
|
|
|
|
REQUIRE(it->key().length()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
274
|
3
|
50
|
|
|
|
|
REQUIRE(it->value()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
275
|
3
|
50
|
|
|
|
|
REQUIRE(it->hash()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
276
|
3
|
50
|
|
|
|
|
check[it->key()] = it->value(); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
277
|
|
|
|
|
|
|
} |
278
|
1
|
50
|
|
|
|
|
REQUIRE(cnt == 3); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
279
|
1
|
50
|
|
|
|
|
REQUIRE(check.size() == 3); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
280
|
1
|
50
|
|
|
|
|
REQUIRE(check["key"].get() == vars.iv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
281
|
1
|
50
|
|
|
|
|
REQUIRE(check["name"].get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
282
|
1
|
50
|
|
|
|
|
REQUIRE(check["ref"].get() == vars.rv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
283
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt+2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
284
|
1
|
50
|
|
|
|
|
check.clear(); |
285
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt+1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
286
|
|
|
|
|
|
|
|
287
|
4
|
50
|
|
|
|
|
for (auto it = o.begin(); it != o.end(); ++it) { |
|
|
100
|
|
|
|
|
|
288
|
3
|
50
|
|
|
|
|
it->value(vars.pv); |
289
|
|
|
|
|
|
|
} |
290
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.iv) == icnt); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
291
|
1
|
50
|
|
|
|
|
REQUIRE(SvREFCNT(vars.pv) == pcnt+3); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
292
|
1
|
50
|
|
|
|
|
REQUIRE(o["key"].get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
293
|
1
|
50
|
|
|
|
|
REQUIRE(o["name"].get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
294
|
1
|
50
|
|
|
|
|
REQUIRE(o["ref"].get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
91
|
50
|
|
|
|
|
SECTION("const iterate") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
298
|
2
|
|
|
|
|
|
Hash src; |
299
|
1
|
|
|
|
|
|
const Hash& o = src; |
300
|
1
|
50
|
|
|
|
|
REQUIRE(o.begin() == o.end()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
301
|
1
|
50
|
|
|
|
|
src = Hash::create(); |
302
|
1
|
50
|
|
|
|
|
REQUIRE(o.cbegin() == o.cend()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
303
|
1
|
50
|
|
|
|
|
src["key"] = vars.iv; |
|
|
50
|
|
|
|
|
|
304
|
1
|
50
|
|
|
|
|
src["name"] = vars.pv; |
|
|
50
|
|
|
|
|
|
305
|
1
|
50
|
|
|
|
|
src["ref"] = vars.rv; |
|
|
50
|
|
|
|
|
|
306
|
|
|
|
|
|
|
|
307
|
2
|
50
|
|
|
|
|
Hash check = Hash::create(); |
308
|
1
|
|
|
|
|
|
int cnt = 0; |
309
|
4
|
50
|
|
|
|
|
for (auto it = o.cbegin(); it != o.cend(); ++it) { |
|
|
100
|
|
|
|
|
|
310
|
3
|
|
|
|
|
|
cnt++; |
311
|
3
|
50
|
|
|
|
|
REQUIRE(it->key().length()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
312
|
3
|
50
|
|
|
|
|
REQUIRE(it->value()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
313
|
3
|
50
|
|
|
|
|
REQUIRE(it->hash()); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
314
|
3
|
50
|
|
|
|
|
check[it->key()] = it->value(); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
315
|
|
|
|
|
|
|
} |
316
|
1
|
50
|
|
|
|
|
REQUIRE(cnt == 3); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
317
|
1
|
50
|
|
|
|
|
REQUIRE(check.size() == 3); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
318
|
1
|
50
|
|
|
|
|
REQUIRE(check["key"].get() == vars.iv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
319
|
1
|
50
|
|
|
|
|
REQUIRE(check["name"].get() == vars.pv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
320
|
1
|
50
|
|
|
|
|
REQUIRE(check["ref"].get() == vars.rv); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
91
|
50
|
|
|
|
|
SECTION("multi-deref") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
324
|
2
|
50
|
|
|
|
|
auto o = Hash::create(); |
325
|
2
|
50
|
|
|
|
|
o["key1"] = Ref::create(Array::create({Simple(100)})); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
326
|
1
|
50
|
|
|
|
|
o["key2"] = Simple(1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
327
|
2
|
50
|
|
|
|
|
Simple res = o["key1"][0]; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
328
|
1
|
50
|
|
|
|
|
REQUIRE(res); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
329
|
1
|
50
|
|
|
|
|
REQUIRE(res == 100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
330
|
1
|
50
|
|
|
|
|
o["key1"][0] = Simple(200); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
331
|
1
|
50
|
|
|
|
|
REQUIRE(o["key1"][0]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
332
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key1"][0]) == 200); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
333
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o["key2"][0]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
335
|
2
|
50
|
|
|
|
|
auto h = Hash::create(); |
336
|
1
|
50
|
|
|
|
|
h["key"] = Simple(100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
337
|
1
|
50
|
|
|
|
|
o.store("key3", Ref::create(h)); |
|
|
50
|
|
|
|
|
|
338
|
1
|
50
|
|
|
|
|
res = o["key3"]["key"]; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
339
|
1
|
50
|
|
|
|
|
REQUIRE(res); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
340
|
1
|
50
|
|
|
|
|
REQUIRE(res == 100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
341
|
1
|
50
|
|
|
|
|
o["key3"]["key"] = Simple(200); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
342
|
1
|
50
|
|
|
|
|
REQUIRE(o["key3"]["key"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
343
|
1
|
50
|
|
|
|
|
REQUIRE(Simple(o["key3"]["key"]) == 200); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
344
|
1
|
50
|
|
|
|
|
REQUIRE_THROWS(o["key2"]["key"]); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
345
|
|
|
|
|
|
|
} |
346
|
|
|
|
|
|
|
|
347
|
91
|
50
|
|
|
|
|
SECTION("capacity") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
348
|
2
|
|
|
|
|
|
Hash o; |
349
|
1
|
50
|
|
|
|
|
REQUIRE(o.capacity() == 0); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
350
|
1
|
50
|
|
|
|
|
o = Hash::create(); |
351
|
1
|
50
|
|
|
|
|
o["a"] = Simple(1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
352
|
1
|
50
|
|
|
|
|
o["b"] = Simple(1); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
353
|
1
|
50
|
|
|
|
|
REQUIRE(o.capacity() >= 2); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
354
|
|
|
|
|
|
|
} |
355
|
|
|
|
|
|
|
|
356
|
91
|
50
|
|
|
|
|
SECTION("reserve") { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
357
|
2
|
50
|
|
|
|
|
auto o = Hash::create(); |
358
|
1
|
50
|
|
|
|
|
o.reserve(100); |
359
|
1
|
50
|
|
|
|
|
REQUIRE(o.capacity() >= 100); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
360
|
|
|
|
|
|
|
} |
361
|
226
|
50
|
|
|
|
|
} |
|
|
50
|
|
|
|
|
|