Skip to content

Commit af39743

Browse files
committed
Format
1 parent 363e966 commit af39743

File tree

2 files changed

+29
-33
lines changed

2 files changed

+29
-33
lines changed

firestore/integration_test_internal/src/aggregate_query_test.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ namespace firestore {
2424

2525
using AggrgegateQueryTest = FirestoreIntegrationTest;
2626

27-
size_t AggregateQueryHash(const AggregateQuery& aggregate_query) { return aggregate_query.Hash(); }
27+
size_t AggregateQueryHash(const AggregateQuery& aggregate_query) {
28+
return aggregate_query.Hash();
29+
}
2830

2931
TEST_F(AggrgegateQueryTest, TestHashCode) {
3032
CollectionReference collection =
@@ -34,8 +36,10 @@ TEST_F(AggrgegateQueryTest, TestHashCode) {
3436
collection.Limit(2).OrderBy("sort", Query::Direction::kAscending);
3537
Query query2 =
3638
collection.Limit(2).OrderBy("sort", Query::Direction::kDescending);
37-
EXPECT_NE(AggregateQueryHash(query1.Count()), AggregateQueryHash(query2.Count()));
38-
EXPECT_EQ(AggregateQueryHash(query1.Count()), AggregateQueryHash(query1.Count()));
39+
EXPECT_NE(AggregateQueryHash(query1.Count()),
40+
AggregateQueryHash(query2.Count()));
41+
EXPECT_EQ(AggregateQueryHash(query1.Count()),
42+
AggregateQueryHash(query1.Count()));
3943
}
4044

4145
} // namespace firestore

firestore/integration_test_internal/src/query_test.cc

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ TEST_F(QueryTest, TestKeyOrderIsDescendingForDescendingInequality) {
242242
QuerySnapshot snapshot = ReadDocuments(query);
243243
EXPECT_EQ(std::vector<std::string>({"g", "f", "c", "b", "a"}),
244244
QuerySnapshotToIds(snapshot));
245-
245+
246246
const AggregateQuery& aggregate_query = query.Count();
247247
AggregateQuerySnapshot aggregate_snapshot = ReadAggregate(aggregate_query);
248248
EXPECT_EQ(5, aggregate_snapshot.count());
@@ -258,8 +258,7 @@ TEST_F(QueryTest, TestUnaryFilterQueries) {
258258
{"nan", FieldValue::Double(NAN)}}}});
259259
const Query& query = collection.WhereEqualTo("null", FieldValue::Null())
260260
.WhereEqualTo("nan", FieldValue::Double(NAN));
261-
QuerySnapshot snapshot =
262-
ReadDocuments(query);
261+
QuerySnapshot snapshot = ReadDocuments(query);
263262
EXPECT_EQ(std::vector<MapFieldValue>({{{"null", FieldValue::Null()},
264263
{"nan", FieldValue::Double(NAN)}}}),
265264
QuerySnapshotToValues(snapshot));
@@ -473,7 +472,7 @@ TEST_F(QueryTest, TestCanQueryByDocumentId) {
473472

474473
// Query by Document Id.
475474
const Query& query1 = collection.WhereEqualTo(FieldPath::DocumentId(),
476-
FieldValue::String("ab"));
475+
FieldValue::String("ab"));
477476
QuerySnapshot snapshot1 = ReadDocuments(query1);
478477
EXPECT_EQ(std::vector<std::string>({"ab"}), QuerySnapshotToIds(snapshot1));
479478

@@ -673,8 +672,7 @@ TEST_F(QueryTest, TestQueriesCanUseNotEqualFiltersWithNan) {
673672

674673
const Query& query =
675674
collection.WhereNotEqualTo("zip", FieldValue::Double(NAN));
676-
QuerySnapshot snapshot =
677-
ReadDocuments(query);
675+
QuerySnapshot snapshot = ReadDocuments(query);
678676
EXPECT_THAT(QuerySnapshotToValues(snapshot),
679677
ElementsAreArray(AllDocsExcept(docs, {"a", "i", "j"})));
680678

@@ -698,12 +696,11 @@ TEST_F(QueryTest, TestQueriesCanUseNotEqualFiltersWithDocIds) {
698696
QuerySnapshot snapshot = ReadDocuments(query);
699697
EXPECT_EQ(std::vector<MapFieldValue>({doc_b, doc_c, doc_d}),
700698
QuerySnapshotToValues(snapshot));
701-
699+
702700
const AggregateQuery& aggregate_query = query.Count();
703701
AggregateQuerySnapshot aggregate_snapshot = ReadAggregate(aggregate_query);
704702
EXPECT_EQ(3, aggregate_snapshot.count());
705703
EXPECT_EQ(aggregate_query, aggregate_snapshot.query());
706-
707704
}
708705

709706
TEST_F(QueryTest, TestQueriesCanUseArrayContainsFilters) {
@@ -740,7 +737,7 @@ TEST_F(QueryTest, TestQueriesCanUseArrayContainsFilters) {
740737
AggregateQuerySnapshot aggregate_snapshot = ReadAggregate(aggregate_query);
741738
EXPECT_EQ(3, aggregate_snapshot.count());
742739
EXPECT_EQ(aggregate_query, aggregate_snapshot.query());
743-
740+
744741
// NOTE: The backend doesn't currently support null, NaN, objects, or arrays,
745742
// so there isn't much of anything else interesting to test.
746743
}
@@ -777,7 +774,7 @@ TEST_F(QueryTest, TestQueriesCanUseInFilters) {
777774
AggregateQuerySnapshot aggregate_snapshot1 = ReadAggregate(aggregate_query1);
778775
EXPECT_EQ(3, aggregate_snapshot1.count());
779776
EXPECT_EQ(aggregate_query1, aggregate_snapshot1.query());
780-
777+
781778
// With objects.
782779
const Query& query2 = collection.WhereIn(
783780
"zip", {FieldValue::Map({{"code", FieldValue::Integer(500)}})});
@@ -844,7 +841,7 @@ TEST_F(QueryTest, TestQueriesCanUseNotInFilters) {
844841
QuerySnapshot snapshot = ReadDocuments(query);
845842
EXPECT_THAT(QuerySnapshotToValues(snapshot),
846843
ElementsAreArray(AllDocsExcept(docs, {"c", "d", "f", "i", "j"})));
847-
844+
848845
const AggregateQuery& aggregate_query = query.Count();
849846
AggregateQuerySnapshot aggregate_snapshot = ReadAggregate(aggregate_query);
850847
EXPECT_EQ(5, aggregate_snapshot.count());
@@ -909,10 +906,9 @@ TEST_F(QueryTest, TestQueriesCanUseNotInFiltersWithNull) {
909906

910907
// With Null, this leads to no result.
911908
const Query& query = collection.WhereNotIn("zip", {{FieldValue::Null()}});
912-
QuerySnapshot snapshot =
913-
ReadDocuments(query);
909+
QuerySnapshot snapshot = ReadDocuments(query);
914910
EXPECT_THAT(QuerySnapshotToValues(snapshot), IsEmpty());
915-
911+
916912
const AggregateQuery& aggregate_query = query.Count();
917913
AggregateQuerySnapshot aggregate_snapshot = ReadAggregate(aggregate_query);
918914
EXPECT_EQ(0, aggregate_snapshot.count());
@@ -944,8 +940,7 @@ TEST_F(QueryTest, TestQueriesCanUseNotInFiltersWithNan) {
944940
// With NAN.
945941
const Query& query =
946942
collection.WhereNotIn("zip", {{FieldValue::Double(NAN)}});
947-
QuerySnapshot snapshot =
948-
ReadDocuments(query);
943+
QuerySnapshot snapshot = ReadDocuments(query);
949944
EXPECT_THAT(QuerySnapshotToValues(snapshot),
950945
ElementsAreArray(AllDocsExcept(docs, {"a", "i", "j"})));
951946

@@ -1051,7 +1046,7 @@ TEST_F(QueryTest, TestQueriesCanUseArrayContainsAnyFilters) {
10511046
AggregateQuerySnapshot aggregate_snapshot1 = ReadAggregate(aggregate_query1);
10521047
EXPECT_EQ(4, aggregate_snapshot1.count());
10531048
EXPECT_EQ(aggregate_query1, aggregate_snapshot1.query());
1054-
1049+
10551050
// With objects
10561051
const Query& query2 = collection.WhereArrayContainsAny(
10571052
"array", {FieldValue::Map({{"a", FieldValue::Integer(42)}})});
@@ -1094,8 +1089,7 @@ TEST_F(QueryTest, TestCollectionGroupQueries) {
10941089
Await(batch.Commit());
10951090

10961091
const Query& query = db->CollectionGroup(collection_group);
1097-
QuerySnapshot query_snapshot =
1098-
ReadDocuments(query);
1092+
QuerySnapshot query_snapshot = ReadDocuments(query);
10991093
EXPECT_EQ(std::vector<std::string>(
11001094
{"cg-doc1", "cg-doc2", "cg-doc3", "cg-doc4", "cg-doc5"}),
11011095
QuerySnapshotToIds(query_snapshot));
@@ -1133,8 +1127,7 @@ TEST_F(QueryTest,
11331127
.OrderBy(FieldPath::DocumentId())
11341128
.StartAt({FieldValue::String("a/b")})
11351129
.EndAt({FieldValue::String("a/b0")});
1136-
QuerySnapshot query_snapshot =
1137-
ReadDocuments(query);
1130+
QuerySnapshot query_snapshot = ReadDocuments(query);
11381131
EXPECT_EQ(std::vector<std::string>({"cg-doc2", "cg-doc3", "cg-doc4"}),
11391132
QuerySnapshotToIds(query_snapshot));
11401133

@@ -1167,13 +1160,13 @@ TEST_F(QueryTest,
11671160
}
11681161
Await(batch.Commit());
11691162

1170-
const Query& query1 = db->CollectionGroup(collection_group)
1171-
.WhereGreaterThanOrEqualTo(FieldPath::DocumentId(),
1172-
FieldValue::String("a/b"))
1173-
.WhereLessThanOrEqualTo(FieldPath::DocumentId(),
1174-
FieldValue::String("a/b0"));
1175-
QuerySnapshot query_snapshot =
1176-
ReadDocuments(query1);
1163+
const Query& query1 =
1164+
db->CollectionGroup(collection_group)
1165+
.WhereGreaterThanOrEqualTo(FieldPath::DocumentId(),
1166+
FieldValue::String("a/b"))
1167+
.WhereLessThanOrEqualTo(FieldPath::DocumentId(),
1168+
FieldValue::String("a/b0"));
1169+
QuerySnapshot query_snapshot = ReadDocuments(query1);
11771170
EXPECT_EQ(std::vector<std::string>({"cg-doc2", "cg-doc3", "cg-doc4"}),
11781171
QuerySnapshotToIds(query_snapshot));
11791172

@@ -1188,8 +1181,7 @@ TEST_F(QueryTest,
11881181
.WhereLessThan(
11891182
FieldPath::DocumentId(),
11901183
FieldValue::String("a/b/" + collection_group + "/cg-doc3"));
1191-
query_snapshot = ReadDocuments(
1192-
query2);
1184+
query_snapshot = ReadDocuments(query2);
11931185
EXPECT_EQ(std::vector<std::string>({"cg-doc2"}),
11941186
QuerySnapshotToIds(query_snapshot));
11951187

0 commit comments

Comments
 (0)