Skip to content

Commit b85b1f8

Browse files
committed
Rename source/gridfs/gridfs-spec.rst to source/gridfs/gridfs-spec.md
1 parent 793c104 commit b85b1f8

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
File renamed without changes.

source/gridfs/tests/README.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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==

0 commit comments

Comments
 (0)