| 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, |
nothing calls this directly
no test coverage detected