@@ -433,6 +433,29 @@ TEST_F(FilterTest, CompositeComparison) {
433
433
EXPECT_NE (or3, or4);
434
434
}
435
435
436
+ TEST_F (FilterTest, QueryWhereComposite) {
437
+ MapFieldValue doc_aa = {{" x" , FieldValue::String (" a" )}, {" y" , FieldValue::String (" a" )}};
438
+ MapFieldValue doc_ab = {{" x" , FieldValue::String (" a" )}, {" y" , FieldValue::String (" b" )}};
439
+ MapFieldValue doc_ba = {{" x" , FieldValue::String (" b" )}, {" y" , FieldValue::String (" a" )}};
440
+ MapFieldValue doc_bb = {{" x" , FieldValue::String (" b" )}, {" y" , FieldValue::String (" b" )}};
441
+ CollectionReference collection =
442
+ Collection ({{" aa" , doc_aa},
443
+ {" ab" , doc_ab},
444
+ {" ba" , doc_ba},
445
+ {" bb" , doc_bb}});
446
+
447
+ Filter filter_xa = Filter::EqualTo (" x" , FieldValue::String (" a" ));
448
+ Filter filter_yb = Filter::EqualTo (" y" , FieldValue::String (" b" ));
449
+
450
+ QuerySnapshot snapshot1 =
451
+ ReadDocuments (collection.Where (Filter::And (filter_xa, filter_yb)));
452
+ EXPECT_EQ (std::vector<MapFieldValue>({doc_ab}), QuerySnapshotToValues (snapshot1));
453
+
454
+ QuerySnapshot snapshot2 =
455
+ ReadDocuments (collection.Where (Filter::Or (filter_xa, filter_yb)));
456
+ EXPECT_EQ (std::vector<MapFieldValue>({doc_aa, doc_ab, doc_bb}), QuerySnapshotToValues (snapshot2));
457
+ }
458
+
436
459
} // namespace
437
460
438
461
} // namespace firestore
0 commit comments