Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 3935a2a

Browse files
committed
PHPLIB-1339 Add tests on Bitwise Query Operators
1 parent 149dca6 commit 3935a2a

14 files changed

+648
-52
lines changed

generator/config/query/bitsAllClear.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,29 @@ arguments:
1212
type:
1313
- int
1414
- binData
15-
- array # of int
15+
variadic: array
16+
tests:
17+
-
18+
name: 'Bit Position Array'
19+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#bit-position-array'
20+
pipeline:
21+
-
22+
$match:
23+
a:
24+
$bitsAllClear: [1, 5]
25+
-
26+
name: 'Integer Bitmask'
27+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#integer-bitmask'
28+
pipeline:
29+
- $match:
30+
a:
31+
# $bitsAllClear: 35
32+
$bitsAllClear: [35]
33+
-
34+
name: 'BinData Bitmask'
35+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#bindata-bitmask'
36+
pipeline:
37+
- $match:
38+
a:
39+
$bitsAllClear:
40+
- { $binary: { base64: 'TUM9PQ==', subType: '00' } }

generator/config/query/bitsAllSet.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,29 @@ arguments:
1212
type:
1313
- int
1414
- binData
15-
- array # of int
15+
variadic: array
16+
tests:
17+
-
18+
name: 'Bit Position Array'
19+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#bit-position-array'
20+
pipeline:
21+
-
22+
$match:
23+
a:
24+
$bitsAllSet: [1, 5]
25+
-
26+
name: 'Integer Bitmask'
27+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#integer-bitmask'
28+
pipeline:
29+
- $match:
30+
a:
31+
# $bitsAllSet: 50
32+
$bitsAllSet: [50]
33+
-
34+
name: 'BinData Bitmask'
35+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#bindata-bitmask'
36+
pipeline:
37+
- $match:
38+
a:
39+
$bitsAllSet:
40+
- { $binary: { base64: 'TUM9PQ==', subType: '00' } }

generator/config/query/bitsAnyClear.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,29 @@ arguments:
1212
type:
1313
- int
1414
- binData
15-
- array # of int
15+
variadic: array
16+
tests:
17+
-
18+
name: 'Bit Position Array'
19+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#bit-position-array'
20+
pipeline:
21+
-
22+
$match:
23+
a:
24+
$bitsAnyClear: [1, 5]
25+
-
26+
name: 'Integer Bitmask'
27+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#integer-bitmask'
28+
pipeline:
29+
- $match:
30+
a:
31+
# $bitsAnyClear: 35
32+
$bitsAnyClear: [35]
33+
-
34+
name: 'BinData Bitmask'
35+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#bindata-bitmask'
36+
pipeline:
37+
- $match:
38+
a:
39+
$bitsAnyClear:
40+
- { $binary: { base64: 'TUM9PQ==', subType: '00' } }

generator/config/query/bitsAnySet.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,29 @@ arguments:
1212
type:
1313
- int
1414
- binData
15-
- array # of int
15+
variadic: array
16+
tests:
17+
-
18+
name: 'Bit Position Array'
19+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#bit-position-array'
20+
pipeline:
21+
-
22+
$match:
23+
a:
24+
$bitsAnySet: [1, 5]
25+
-
26+
name: 'Integer Bitmask'
27+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#integer-bitmask'
28+
pipeline:
29+
- $match:
30+
a:
31+
# $bitsAnySet: 35
32+
$bitsAnySet: [35]
33+
-
34+
name: 'BinData Bitmask'
35+
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#bindata-bitmask'
36+
pipeline:
37+
- $match:
38+
a:
39+
$bitsAnySet:
40+
- { $binary: { base64: 'TUM9PQ==', subType: '00' } }

src/Builder/Query/BitsAllClearOperator.php

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Query/BitsAllSetOperator.php

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Query/BitsAnyClearOperator.php

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Query/BitsAnySetOperator.php

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Query/FactoryTrait.php

Lines changed: 16 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)