-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cee096
commit c9e0572
Showing
26 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
core/src/test/java/dev/morphia/test/query/filters/TestBitsAnyClear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.morphia.test.query.filters; | ||
|
||
import dev.morphia.test.ServerVersion; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import static dev.morphia.query.filters.Filters.bitsAnyClear; | ||
|
||
public class TestBitsAnyClear extends FilterTest { | ||
@Test | ||
public void testExample1() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnyClear("a", new int[] { 1, 5 }))); | ||
} | ||
|
||
@Test | ||
public void testExample2() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnyClear("a", 35))); | ||
} | ||
|
||
@Test | ||
public void testExample3() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnyClear("a", new byte[] { 48 }))); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
core/src/test/java/dev/morphia/test/query/filters/TestBitsAnySet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.morphia.test.query.filters; | ||
|
||
import dev.morphia.test.ServerVersion; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import static dev.morphia.query.filters.Filters.bitsAnySet; | ||
|
||
public class TestBitsAnySet extends FilterTest { | ||
@Test | ||
public void testExample1() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnySet("a", new int[] { 1, 5 }))); | ||
} | ||
|
||
@Test | ||
public void testExample2() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnySet("a", 35))); | ||
} | ||
|
||
@Test | ||
public void testExample3() { | ||
testQuery(ServerVersion.ANY, false, true, (query) -> query.filter( | ||
bitsAnySet("a", new byte[] { 48 }))); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example1/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnyClear: [ 1, 5 ] } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example1/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
2 changes: 2 additions & 0 deletions
2
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example1/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" } | ||
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example1/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bit Position Array |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example2/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnyClear: 35 } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example2/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example2/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" } | ||
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" } | ||
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" } | ||
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example2/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Integer Bitmask |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example3/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnyClear: BinData(0, "MA==") } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example3/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
3 changes: 3 additions & 0 deletions
3
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example3/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" } | ||
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" } | ||
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnyClear/example3/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BinData Bitmask |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example1/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnySet: [ 1, 5 ] } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example1/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
2 changes: 2 additions & 0 deletions
2
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example1/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" } | ||
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example1/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Bit Position Array |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example2/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnySet: 35 } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example2/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
2 changes: 2 additions & 0 deletions
2
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example2/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" } | ||
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example2/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Integer Bitmask |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example3/action.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
db.collection.find( { a: { $bitsAnySet: BinData(0, "MA==") } } ) |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example3/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ _id: 1, a: 54, binaryValueofA: "00110110" }, | ||
{ _id: 2, a: 20, binaryValueofA: "00010100" }, | ||
{ _id: 3, a: 20.0, binaryValueofA: "00010100" }, | ||
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" } |
4 changes: 4 additions & 0 deletions
4
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example3/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" } | ||
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" } | ||
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" } | ||
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" } |
1 change: 1 addition & 0 deletions
1
core/src/test/resources/dev/morphia/test/query/filters/bitsAnySet/example3/name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BinData Bitmask |