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

Method createItems

Tests/HashTreeTests.cc:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 Doc _doc;
35
36 void createItems(size_t N) {
37 Encoder enc;
38 enc.beginArray(N);
39 for (size_t i = 0; i < N; i++)
40 enc.writeInt(i);
41 enc.endArray();
42 _doc = enc.finishDoc();
43 values = _doc.asArray();
44
45 keys.clear();
46 for (size_t i = 0; i < N; i++) {
47 char buf[100];
48 if (i < 100)
49 sprintf(buf, "%s %s", kDigits[i/10], kDigits[i%10]);
50 else
51 sprintf(buf, "%zd %s", i/10, kDigits[i%10]);
52 keys.push_back(alloc_slice(buf));
53 }
54 }
55
56 void insertItems(size_t N =0, bool verbose= false, bool check =false) {
57 if (N == 0)

Callers

nothing calls this directly

Calls 7

alloc_sliceFunction · 0.50
beginArrayMethod · 0.45
writeIntMethod · 0.45
endArrayMethod · 0.45
finishDocMethod · 0.45
asArrayMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected