MCPcopy Create free account
hub / github.com/couchbase/fleece / testArrayOfLength

Method testArrayOfLength

Tests/EncoderTests.cc:150–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 void testArrayOfLength(unsigned length) {
151 enc.beginArray();
152 for (unsigned i = 0; i < length; ++i)
153 enc.writeUInt(i);
154 enc.endArray();
155 endEncoding();
156
157 // Check the contents:
158 auto a = checkArray(length);
159 for (unsigned i = 0; i < length; ++i) {
160 auto v = a->get(i);
161 if (!v || v->type() != kNumber || v->asUnsigned() != (uint64_t)i) {
162 REQUIRE(v);
163 REQUIRE(v->type() == kNumber);
164 REQUIRE(v->asUnsigned() == (uint64_t)i);
165 }
166 }
167 }
168
169 void checkJSONStr(std::string json,
170 slice expectedStr,

Callers

nothing calls this directly

Calls 6

beginArrayMethod · 0.45
writeUIntMethod · 0.45
endArrayMethod · 0.45
getMethod · 0.45
typeMethod · 0.45
asUnsignedMethod · 0.45

Tested by

no test coverage detected