Skip to content

Commit 03aefac

Browse files
sync unified tests
1 parent 320dde0 commit 03aefac

13 files changed

+3481
-955
lines changed

test/spec/gridfs/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# GridFS Tests
2+
3+
______________________________________________________________________
4+
5+
## Introduction
6+
7+
The YAML and JSON files in this directory are platform-independent tests meant to exercise a driver's implementation of
8+
GridFS. These tests utilize the [Unified Test Format](../../unified-test-format/unified-test-format.md).
9+
10+
## Conventions for Expressing Binary Data
11+
12+
The unified test format allows binary stream data to be expressed and matched with `$$hexBytes` (for uploads) and
13+
`$$matchesHexBytes` (for downloads), respectively; however, those operators are not supported in all contexts, such as
14+
`insertData` and `outcome`. When binary data must be expressed as a base64-encoded string
15+
([Extended JSON](../../extended-json.md) for a BSON binary type), the test SHOULD include a comment noting the
16+
equivalent value in hexadecimal for human-readability. For example:
17+
18+
```yaml
19+
data: { $binary: { base64: "ESIzRA==", subType: "00" } } # hex 11223344
20+
```
21+
22+
Creating the base64-encoded string for a sequence of hexadecimal bytes is left as an exercise to the developer. Consider
23+
the following PHP one-liner:
24+
25+
```shell-session
26+
$ php -r 'echo base64_encode(hex2bin('11223344')), "\n";'
27+
ESIzRA==
28+
```

0 commit comments

Comments
 (0)