| 232 | } |
| 233 | |
| 234 | void decode_decimal128() |
| 235 | { |
| 236 | std::vector<uint8_t> input = { |
| 237 | 0x18,0x00,0x00,0x00, // Document has 24 bytes |
| 238 | 0x13, // 128-bit decimal floating point |
| 239 | 0x61,0x00, // "a" |
| 240 | 0x01,0x00,0x00,0x00, |
| 241 | 0x00,0x00,0x00,0x00, // 1E-6176 |
| 242 | 0x00,0x00,0x00,0x00, |
| 243 | 0x00,0x00,0x00,0x00, |
| 244 | 0x00 // terminating null |
| 245 | }; |
| 246 | |
| 247 | json j = bson::decode_bson<json>(input); |
| 248 | |
| 249 | std::cout << "(1) " << j << "\n\n"; |
| 250 | std::cout << "(2) " << j.at("a").tag() << "\n\n"; |
| 251 | |
| 252 | std::vector<uint8_t> output; |
| 253 | bson::encode_bson(j, output); |
| 254 | assert(output == input); |
| 255 | } |
| 256 | |
| 257 | void encode_decimal128() |
| 258 | { |
no test coverage detected