File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change
1
+ ============
2
+ GridFS Tests
3
+ ============
4
+
5
+ .. contents ::
6
+
7
+ ----
8
+
9
+ Introduction
10
+ ============
11
+
12
+ The YAML and JSON files in this directory are platform-independent tests
13
+ meant to exercise a driver's implementation of GridFS. These tests utilize the
14
+ `Unified Test Format <../../unified-test-format/unified-test-format.md >`__.
15
+
16
+ Conventions for Expressing Binary Data
17
+ ======================================
18
+
19
+ The unified test format allows binary stream data to be expressed and matched
20
+ with ``$$hexBytes `` (for uploads) and ``$$matchesHexBytes `` (for downloads),
21
+ respectively; however, those operators are not supported in all contexts, such
22
+ as ``insertData `` and ``outcome ``. When binary data must be expressed as a
23
+ base64-encoded string (`Extended JSON <../../extended-json.rst >`__ for a BSON
24
+ binary type), the test SHOULD include a comment noting the equivalent value in
25
+ hexadecimal for human-readability. For example:
26
+
27
+ .. code :: yaml
28
+
29
+ data : { $binary: { base64: "ESIzRA==", subType: "00" } } # hex 11223344
30
+
31
+ Creating the base64-encoded string for a sequence of hexadecimal bytes is left
32
+ as an exercise to the developer. Consider the following PHP one-liner:
33
+
34
+ .. code :: shell-session
35
+
36
+ $ php -r 'echo base64_encode(hex2bin('11223344')), "\n";'
37
+ ESIzRA==
You can’t perform that action at this time.
0 commit comments