This repository was archived by the owner on Feb 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +332
-0
lines changed
generator/config/expression Expand file tree Collapse file tree 9 files changed +332
-0
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,24 @@ arguments:
15
15
- resolvesToInt
16
16
- resolvesToLong
17
17
variadic : array
18
+ tests :
19
+ -
20
+ name : ' Bitwise AND with Two Integers'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/#bitwise-and-with-two-integers'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ result :
26
+ $bitAnd :
27
+ - ' $a'
28
+ - ' $b'
29
+ -
30
+ name : ' Bitwise AND with a Long and Integer'
31
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/#bitwise-and-with-a-long-and-integer'
32
+ pipeline :
33
+ -
34
+ $project :
35
+ result :
36
+ $bitAnd :
37
+ - ' $a'
38
+ - { "$numberLong": "63" }
Original file line number Diff line number Diff line change @@ -14,3 +14,12 @@ arguments:
14
14
type :
15
15
- resolvesToInt
16
16
- resolvesToLong
17
+ tests :
18
+ -
19
+ name : ' Example'
20
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/#example'
21
+ pipeline :
22
+ -
23
+ $project :
24
+ result :
25
+ $bitNot : ' $a'
Original file line number Diff line number Diff line change @@ -15,3 +15,24 @@ arguments:
15
15
- resolvesToInt
16
16
- resolvesToLong
17
17
variadic : array
18
+ tests :
19
+ -
20
+ name : ' Bitwise OR with Two Integers'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/#bitwise-or-with-two-integers'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ result :
26
+ $bitOr :
27
+ - ' $a'
28
+ - ' $b'
29
+ -
30
+ name : ' Bitwise OR with a Long and Integer'
31
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/#bitwise-or-with-a-long-and-integer'
32
+ pipeline :
33
+ -
34
+ $project :
35
+ result :
36
+ $bitOr :
37
+ - ' $a'
38
+ - { "$numberLong": "63" }
Original file line number Diff line number Diff line change @@ -15,3 +15,14 @@ arguments:
15
15
- resolvesToInt
16
16
- resolvesToLong
17
17
variadic : array
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ result :
26
+ $bitXor :
27
+ - ' $a'
28
+ - ' $b'
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \BSON \Int64 ;
8
+ use MongoDB \Builder \Expression ;
9
+ use MongoDB \Builder \Pipeline ;
10
+ use MongoDB \Builder \Stage ;
11
+ use MongoDB \Tests \Builder \PipelineTestCase ;
12
+
13
+ /**
14
+ * Test $bitAnd expression
15
+ */
16
+ class BitAndOperatorTest extends PipelineTestCase
17
+ {
18
+ public function testBitwiseANDWithALongAndInteger (): void
19
+ {
20
+ $ pipeline = new Pipeline (
21
+ Stage::project (
22
+ result: Expression::bitAnd (
23
+ Expression::longFieldPath ('a ' ),
24
+ new Int64 ('63 ' ),
25
+ ),
26
+ ),
27
+ );
28
+
29
+ $ this ->assertSamePipeline (Pipelines::BitAndBitwiseANDWithALongAndInteger, $ pipeline );
30
+ }
31
+
32
+ public function testBitwiseANDWithTwoIntegers (): void
33
+ {
34
+ $ pipeline = new Pipeline (
35
+ Stage::project (
36
+ result: Expression::bitAnd (
37
+ Expression::intFieldPath ('a ' ),
38
+ Expression::intFieldPath ('b ' ),
39
+ ),
40
+ ),
41
+ );
42
+
43
+ $ this ->assertSamePipeline (Pipelines::BitAndBitwiseANDWithTwoIntegers, $ pipeline );
44
+ }
45
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $bitNot expression
14
+ */
15
+ class BitNotOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ result: Expression::bitNot (
22
+ Expression::longFieldPath ('a ' ),
23
+ ),
24
+ ),
25
+ );
26
+
27
+ $ this ->assertSamePipeline (Pipelines::BitNotExample, $ pipeline );
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \BSON \Int64 ;
8
+ use MongoDB \Builder \Expression ;
9
+ use MongoDB \Builder \Pipeline ;
10
+ use MongoDB \Builder \Stage ;
11
+ use MongoDB \Tests \Builder \PipelineTestCase ;
12
+
13
+ /**
14
+ * Test $bitOr expression
15
+ */
16
+ class BitOrOperatorTest extends PipelineTestCase
17
+ {
18
+ public function testBitwiseORWithALongAndInteger (): void
19
+ {
20
+ $ pipeline = new Pipeline (
21
+ Stage::project (
22
+ result: Expression::bitOr (
23
+ Expression::longFieldPath ('a ' ),
24
+ new Int64 ('63 ' ),
25
+ ),
26
+ ),
27
+ );
28
+
29
+ $ this ->assertSamePipeline (Pipelines::BitOrBitwiseORWithALongAndInteger, $ pipeline );
30
+ }
31
+
32
+ public function testBitwiseORWithTwoIntegers (): void
33
+ {
34
+ $ pipeline = new Pipeline (
35
+ Stage::project (
36
+ result: Expression::bitOr (
37
+ Expression::intFieldPath ('a ' ),
38
+ Expression::intFieldPath ('b ' ),
39
+ ),
40
+ ),
41
+ );
42
+
43
+ $ this ->assertSamePipeline (Pipelines::BitOrBitwiseORWithTwoIntegers, $ pipeline );
44
+ }
45
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $bitXor expression
14
+ */
15
+ class BitXorOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ result: Expression::bitXor (
22
+ Expression::longFieldPath ('a ' ),
23
+ Expression::longFieldPath ('b ' ),
24
+ ),
25
+ ),
26
+ );
27
+
28
+ $ this ->assertSamePipeline (Pipelines::BitXorExample, $ pipeline );
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments