Skip to content

Commit 41f9dd1

Browse files
committed
Resyncs tests from DRIVERS-3097 Update test cases for BSON Binary Vector (mongodb#1750)
1 parent 85ca6f1 commit 41f9dd1

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

test/bson_binary_vector/float32.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
"padding": 0,
1212
"canonical_bson": "1C00000005766563746F72000A0000000927000000FE420000E04000"
1313
},
14+
{
15+
"description": "Vector with decimals and negative value FLOAT32",
16+
"valid": true,
17+
"vector": [127.7, -7.7],
18+
"dtype_hex": "0x27",
19+
"dtype_alias": "FLOAT32",
20+
"padding": 0,
21+
"canonical_bson": "1C00000005766563746F72000A0000000927006666FF426666F6C000"
22+
},
1423
{
1524
"description": "Empty Vector FLOAT32",
1625
"valid": true,
@@ -35,8 +44,22 @@
3544
"vector": [127.0, 7.0],
3645
"dtype_hex": "0x27",
3746
"dtype_alias": "FLOAT32",
38-
"padding": 3
47+
"padding": 3,
48+
"canonical_bson": "1C00000005766563746F72000A0000000927030000FE420000E04000"
49+
},
50+
{
51+
"description": "Insufficient vector data with 3 bytes FLOAT32",
52+
"valid": false,
53+
"dtype_hex": "0x27",
54+
"dtype_alias": "FLOAT32",
55+
"canonical_bson": "1700000005766563746F7200050000000927002A2A2A00"
56+
},
57+
{
58+
"description": "Insufficient vector data with 5 bytes FLOAT32",
59+
"valid": false,
60+
"dtype_hex": "0x27",
61+
"dtype_alias": "FLOAT32",
62+
"canonical_bson": "1900000005766563746F7200070000000927002A2A2A2A2A00"
3963
}
4064
]
4165
}
42-

test/bson_binary_vector/int8.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"vector": [127, 7],
4343
"dtype_hex": "0x03",
4444
"dtype_alias": "INT8",
45-
"padding": 3
45+
"padding": 3,
46+
"canonical_bson": "1600000005766563746F7200040000000903037F0700"
4647
},
4748
{
4849
"description": "INT8 with float inputs",
@@ -54,4 +55,3 @@
5455
}
5556
]
5657
}
57-

test/bson_binary_vector/packed_bit.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
"description": "Tests of Binary subtype 9, Vectors, with dtype PACKED_BIT",
33
"test_key": "vector",
44
"tests": [
5+
{
6+
"description": "Padding specified with no vector data PACKED_BIT",
7+
"valid": false,
8+
"vector": [],
9+
"dtype_hex": "0x10",
10+
"dtype_alias": "PACKED_BIT",
11+
"padding": 1,
12+
"canonical_bson": "1400000005766563746F72000200000009100100"
13+
},
514
{
615
"description": "Simple Vector PACKED_BIT",
716
"valid": true,
@@ -44,7 +53,31 @@
4453
"dtype_hex": "0x10",
4554
"dtype_alias": "PACKED_BIT",
4655
"padding": 0
56+
},
57+
{
58+
"description": "Vector with float values PACKED_BIT",
59+
"valid": false,
60+
"vector": [127.5],
61+
"dtype_hex": "0x10",
62+
"dtype_alias": "PACKED_BIT",
63+
"padding": 0
64+
},
65+
{
66+
"description": "Exceeding maximum padding PACKED_BIT",
67+
"valid": false,
68+
"vector": [1],
69+
"dtype_hex": "0x10",
70+
"dtype_alias": "PACKED_BIT",
71+
"padding": 8,
72+
"canonical_bson": "1500000005766563746F7200030000000910080100"
73+
},
74+
{
75+
"description": "Negative padding PACKED_BIT",
76+
"valid": false,
77+
"vector": [1],
78+
"dtype_hex": "0x10",
79+
"dtype_alias": "PACKED_BIT",
80+
"padding": -1
4781
}
4882
]
4983
}
50-

0 commit comments

Comments
 (0)