Skip to content

Commit f669bcf

Browse files
authored
Add equality operator on aggregate query. (#11200)
* Add equality operator on aggregate query. * Revert file not to have been included in previous commit. * Add AggregateQuery tests * Pretty * Copyright * Undo * Improve aggregate query tests. * Pretty * Add test to Xcode
1 parent 8efafcb commit f669bcf

File tree

6 files changed

+169
-9
lines changed

6 files changed

+169
-9
lines changed

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@
165165
1B816F48012524939CA57CB3 /* user_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = CCC9BD953F121B9E29F9AA42 /* user_test.cc */; };
166166
1B9653C51491FAA4BCDE1E11 /* byte_stream_apple_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7628664347B9C96462D4BF17 /* byte_stream_apple_test.mm */; };
167167
1B9E54F4C4280A713B825981 /* token_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = A082AFDD981B07B5AD78FDE8 /* token_test.cc */; };
168+
1B9F95EE29FAD4CD00EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
169+
1B9F95EF29FAD4CF00EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
170+
1B9F95F029FAD4D700EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
171+
1B9F95F129FAD4D800EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
172+
1B9F95F229FAD4E000EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
173+
1B9F95F329FAD4E100EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */; };
174+
1B9F95F52A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
175+
1B9F95F62A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
176+
1B9F95F72A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
177+
1B9F95F82A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
178+
1B9F95F92A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
179+
1B9F95FA2A0933AA00EEC075 /* aggregate_query_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */; };
168180
1BB0C34B2E8D8BCC5882430A /* garbage_collection_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = AAED89D7690E194EF3BA1132 /* garbage_collection_spec_test.json */; };
169181
1BF1F9A0CBB6B01654D3C2BE /* field_transform_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7515B47C92ABEEC66864B55C /* field_transform_test.cc */; };
170182
1C19D796DB6715368407387A /* annotations.pb.cc in Sources */ = {isa = PBXBuildFile; fileRef = 618BBE9520B89AAC00B5BCE7 /* annotations.pb.cc */; };
@@ -1479,6 +1491,8 @@
14791491
132E32997D781B896672D30A /* reference_set_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = reference_set_test.cc; sourceTree = "<group>"; };
14801492
166CE73C03AB4366AAC5201C /* leveldb_index_manager_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = leveldb_index_manager_test.cc; sourceTree = "<group>"; };
14811493
1B342370EAE3AA02393E33EB /* cc_compilation_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = cc_compilation_test.cc; path = api/cc_compilation_test.cc; sourceTree = "<group>"; };
1494+
1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FIRAggregateQueryUnitTests.mm; sourceTree = "<group>"; };
1495+
1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = aggregate_query_test.cc; path = api/aggregate_query_test.cc; sourceTree = "<group>"; };
14821496
1C01D8CE367C56BB2624E299 /* index.pb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = index.pb.h; path = admin/index.pb.h; sourceTree = "<group>"; };
14831497
1C3F7302BF4AE6CBC00ECDD0 /* resource.pb.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = resource.pb.cc; sourceTree = "<group>"; };
14841498
1CA9800A53669EFBFFB824E3 /* memory_remote_document_cache_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = memory_remote_document_cache_test.cc; sourceTree = "<group>"; };
@@ -1716,7 +1730,7 @@
17161730
8A41BBE832158C76BE901BC9 /* mutation_queue_test.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = mutation_queue_test.h; sourceTree = "<group>"; };
17171731
8ABAC2E0402213D837F73DC3 /* defer_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = defer_test.cc; sourceTree = "<group>"; };
17181732
8C058C8BE2723D9A53CCD64B /* persistence_testing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = persistence_testing.h; sourceTree = "<group>"; };
1719-
8C7278B604B8799F074F4E8C /* index_spec_test.json */ = {isa = PBXFileReference; includeInIndex = 1; path = index_spec_test.json; sourceTree = "<group>"; };
1733+
8C7278B604B8799F074F4E8C /* index_spec_test.json */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.json; path = index_spec_test.json; sourceTree = "<group>"; };
17201734
8D9892F204959C50613F16C8 /* FSTUserDataReaderTests.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = FSTUserDataReaderTests.mm; sourceTree = "<group>"; };
17211735
8E002F4AD5D9B6197C940847 /* Firestore.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Firestore.podspec; path = ../Firestore.podspec; sourceTree = "<group>"; };
17221736
8E9CD82E60893DDD7757B798 /* leveldb_bundle_cache_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = leveldb_bundle_cache_test.cc; sourceTree = "<group>"; };
@@ -1739,7 +1753,7 @@
17391753
A5FA86650A18F3B7A8162287 /* Pods-Firestore_Benchmarks_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Benchmarks_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Benchmarks_iOS/Pods-Firestore_Benchmarks_iOS.release.xcconfig"; sourceTree = "<group>"; };
17401754
A70E82DD627B162BEF92B8ED /* Pods-Firestore_Example_tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Example_tvOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Example_tvOS/Pods-Firestore_Example_tvOS.debug.xcconfig"; sourceTree = "<group>"; };
17411755
A853C81A6A5A51C9D0389EDA /* bundle_loader_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = bundle_loader_test.cc; path = bundle/bundle_loader_test.cc; sourceTree = "<group>"; };
1742-
AAED89D7690E194EF3BA1132 /* garbage_collection_spec_test.json */ = {isa = PBXFileReference; includeInIndex = 1; path = garbage_collection_spec_test.json; sourceTree = "<group>"; };
1756+
AAED89D7690E194EF3BA1132 /* garbage_collection_spec_test.json */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.json; path = garbage_collection_spec_test.json; sourceTree = "<group>"; };
17431757
AB323F9553050F4F6490F9FF /* pretty_printing_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = pretty_printing_test.cc; path = nanopb/pretty_printing_test.cc; sourceTree = "<group>"; };
17441758
AB380CF82019382300D97691 /* target_id_generator_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = target_id_generator_test.cc; sourceTree = "<group>"; };
17451759
AB380CFC201A2EE200D97691 /* string_util_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_util_test.cc; sourceTree = "<group>"; };
@@ -1818,7 +1832,7 @@
18181832
DAFF0D0221E64AC40062958F /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = "<group>"; };
18191833
DB1F1E1B1ED15E8D042144B1 /* leveldb_query_engine_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = leveldb_query_engine_test.cc; sourceTree = "<group>"; };
18201834
DB5A1E760451189DA36028B3 /* memory_index_manager_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = memory_index_manager_test.cc; sourceTree = "<group>"; };
1821-
DD12BC1DB2480886D2FB0005 /* settings_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; name = settings_test.cc; path = api/settings_test.cc; sourceTree = "<group>"; };
1835+
DD12BC1DB2480886D2FB0005 /* settings_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = settings_test.cc; path = api/settings_test.cc; sourceTree = "<group>"; };
18221836
DE03B2E91F2149D600A30B9C /* Firestore_IntegrationTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Firestore_IntegrationTests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
18231837
DE0761F61F2FE68D003233AF /* BasicCompileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCompileTests.swift; sourceTree = "<group>"; };
18241838
DE51B1881F0D48AC0013853F /* FSTHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FSTHelpers.h; sourceTree = "<group>"; };
@@ -2508,6 +2522,7 @@
25082522
8FC5BFAD63BAC5AADAC8A94A /* api */ = {
25092523
isa = PBXGroup;
25102524
children = (
2525+
1B9F95F42A0933AA00EEC075 /* aggregate_query_test.cc */,
25112526
1B342370EAE3AA02393E33EB /* cc_compilation_test.cc */,
25122527
8F1A7B4158D9DD76EE4836BF /* load_bundle_task_test.cc */,
25132528
DD12BC1DB2480886D2FB0005 /* settings_test.cc */,
@@ -2618,6 +2633,7 @@
26182633
DE51B1831F0D48AC0013853F /* API */ = {
26192634
isa = PBXGroup;
26202635
children = (
2636+
1B9F95EC29FAD3F100EEC075 /* FIRAggregateQueryUnitTests.mm */,
26212637
5492E045202154AA00B64F25 /* FIRCollectionReferenceTests.mm */,
26222638
5492E049202154AA00B64F25 /* FIRDocumentReferenceTests.mm */,
26232639
5492E04B202154AA00B64F25 /* FIRDocumentSnapshotTests.mm */,
@@ -3670,6 +3686,7 @@
36703686
F4F00BF4E87D7F0F0F8831DB /* FSTEventAccumulator.mm in Sources */,
36713687
0A6FBE65A7FE048BAD562A15 /* FSTGoogleTestTests.mm in Sources */,
36723688
939C898FE9D129F6A2EA259C /* FSTHelpers.mm in Sources */,
3689+
1B9F95F72A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
36733690
C4055D868A38221B332CD03D /* FSTIntegrationTestCase.mm in Sources */,
36743691
EC80A217F3D66EB0272B36B0 /* FSTLevelDBSpecTests.mm in Sources */,
36753692
6FF2B680CC8631B06C7BD7AB /* FSTMemorySpecTests.mm in Sources */,
@@ -3804,6 +3821,7 @@
38043821
FE9131E2D84A560D287B6F90 /* resource.pb.cc in Sources */,
38053822
C7F174164D7C55E35A526009 /* resource_path_test.cc in Sources */,
38063823
2836CD14F6F0EA3B184E325E /* schedule_test.cc in Sources */,
3824+
1B9F95F029FAD4D700EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
38073825
4DAF501EE4B4DB79ED4239B0 /* secure_random_test.cc in Sources */,
38083826
D57F4CB3C92CE3D4DF329B78 /* serializer_test.cc in Sources */,
38093827
4C5292BF643BF14FA2AC5DB1 /* settings_test.cc in Sources */,
@@ -3880,6 +3898,7 @@
38803898
73E42D984FB36173A2BDA57C /* FSTEventAccumulator.mm in Sources */,
38813899
E375FBA0632EFB4D14C4E5A9 /* FSTGoogleTestTests.mm in Sources */,
38823900
F72DF72447EA7AB9D100816A /* FSTHelpers.mm in Sources */,
3901+
1B9F95F92A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
38833902
AEBF3F80ACC01AA8A27091CD /* FSTIntegrationTestCase.mm in Sources */,
38843903
7495E3BAE536CD839EE20F31 /* FSTLevelDBSpecTests.mm in Sources */,
38853904
EB04FE18E5794FEC187A09E3 /* FSTMemorySpecTests.mm in Sources */,
@@ -4014,6 +4033,7 @@
40144033
0929C73B3F3BFC331E9E9D2F /* resource.pb.cc in Sources */,
40154034
85B8918FC8C5DC62482E39C3 /* resource_path_test.cc in Sources */,
40164035
7F6199159E24E19E2A3F5601 /* schedule_test.cc in Sources */,
4036+
1B9F95F229FAD4E000EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
40174037
A8C9FF6D13E6C83D4AB54EA7 /* secure_random_test.cc in Sources */,
40184038
31A396C81A107D1DEFDF4A34 /* serializer_test.cc in Sources */,
40194039
086A8CEDD4C4D5C858498C2D /* settings_test.cc in Sources */,
@@ -4128,6 +4148,7 @@
41284148
146C140B254F3837A4DD7AE8 /* bits_test.cc in Sources */,
41294149
3DDC57212ADBA9AD498EAA4C /* bundle.pb.cc in Sources */,
41304150
F3DEF2DB11FADAABDAA4C8BB /* bundle_builder.cc in Sources */,
4151+
1B9F95FA2A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
41314152
392966346DA5EB3165E16A22 /* bundle_cache_test.cc in Sources */,
41324153
CE411D4B70353823DE63C0D5 /* bundle_loader_test.cc in Sources */,
41334154
DE45CD044B431DB0525595A5 /* bundle_reader_test.cc in Sources */,
@@ -4194,6 +4215,7 @@
41944215
AD89E95440264713557FB38E /* leveldb_migrations_test.cc in Sources */,
41954216
FE701C2D739A5371BCBD62B9 /* leveldb_mutation_queue_test.cc in Sources */,
41964217
98FE82875A899A40A98AAC22 /* leveldb_opener_test.cc in Sources */,
4218+
1B9F95F329FAD4E100EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
41974219
6F256C06FCBA46378EC35D72 /* leveldb_overlay_migration_manager_test.cc in Sources */,
41984220
153DBBCAF6D4FFA8ABC2EBDF /* leveldb_query_engine_test.cc in Sources */,
41994221
79D86DD18BB54D2D69DC457F /* leveldb_remote_document_cache_test.cc in Sources */,
@@ -4356,6 +4378,7 @@
43564378
C1B4621C0820EEB0AC9CCD22 /* bits_test.cc in Sources */,
43574379
01C66732ECCB83AB1D896026 /* bundle.pb.cc in Sources */,
43584380
EAA1962BFBA0EBFBA53B343F /* bundle_builder.cc in Sources */,
4381+
1B9F95F82A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
43594382
C901A1BFD553B6DD70BB7CC7 /* bundle_cache_test.cc in Sources */,
43604383
5A44725457D6B7805FD66EEB /* bundle_loader_test.cc in Sources */,
43614384
248DE4F56DD938F4DBCCF39B /* bundle_reader_test.cc in Sources */,
@@ -4422,6 +4445,7 @@
44224445
61ECC7CE18700CBD73D0D810 /* leveldb_migrations_test.cc in Sources */,
44234446
A478FDD7C3F48FBFDDA7D8F5 /* leveldb_mutation_queue_test.cc in Sources */,
44244447
A06FBB7367CDD496887B86F8 /* leveldb_opener_test.cc in Sources */,
4448+
1B9F95F129FAD4D800EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
44254449
A9206FF8FF8834347E9C7DDB /* leveldb_overlay_migration_manager_test.cc in Sources */,
44264450
0E4F266A9FDF55CD38BB6D0F /* leveldb_query_engine_test.cc in Sources */,
44274451
A27096F764227BC73526FED3 /* leveldb_remote_document_cache_test.cc in Sources */,
@@ -4556,6 +4580,7 @@
45564580
5492E03E2021401F00B64F25 /* FSTEventAccumulator.mm in Sources */,
45574581
54764FAF1FAA21B90085E60A /* FSTGoogleTestTests.mm in Sources */,
45584582
5492E03F2021401F00B64F25 /* FSTHelpers.mm in Sources */,
4583+
1B9F95F52A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
45594584
5491BC721FB44593008B3588 /* FSTIntegrationTestCase.mm in Sources */,
45604585
5492E03120213FFC00B64F25 /* FSTLevelDBSpecTests.mm in Sources */,
45614586
5492E03420213FFC00B64F25 /* FSTMemorySpecTests.mm in Sources */,
@@ -4690,6 +4715,7 @@
46904715
224496E752E42E220F809FAC /* resource.pb.cc in Sources */,
46914716
B686F2B22025000D0028D6BE /* resource_path_test.cc in Sources */,
46924717
8A76A3A8345B984C91B0843E /* schedule_test.cc in Sources */,
4718+
1B9F95EE29FAD4CD00EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
46934719
54740A571FC914BA00713A1A /* secure_random_test.cc in Sources */,
46944720
61F72C5620BC48FD001A68CB /* serializer_test.cc in Sources */,
46954721
977E0DA564D6EAF975A4A1A0 /* settings_test.cc in Sources */,
@@ -4823,6 +4849,7 @@
48234849
0B9BD73418289EFF91917934 /* bits_test.cc in Sources */,
48244850
F8126CD7308A4B8AEC0F30A8 /* bundle.pb.cc in Sources */,
48254851
5AFA1055E8F6B4E4B1CCE2C4 /* bundle_builder.cc in Sources */,
4852+
1B9F95F62A0933AA00EEC075 /* aggregate_query_test.cc in Sources */,
48264853
AE5E5E4A7BF12C2337AFA13B /* bundle_cache_test.cc in Sources */,
48274854
65D54B964A2021E5A36AB21F /* bundle_loader_test.cc in Sources */,
48284855
B9706A5CD29195A613CF4147 /* bundle_reader_test.cc in Sources */,
@@ -4889,6 +4916,7 @@
48894916
B576823475FBCA5EFA583F9C /* leveldb_migrations_test.cc in Sources */,
48904917
4FAD8823DC37B9CA24379E85 /* leveldb_mutation_queue_test.cc in Sources */,
48914918
4562CDD90F5FF0491F07C5DA /* leveldb_opener_test.cc in Sources */,
4919+
1B9F95EF29FAD4CF00EEC075 /* FIRAggregateQueryUnitTests.mm in Sources */,
48924920
1A1299107EFF68DA9DAB19BD /* leveldb_overlay_migration_manager_test.cc in Sources */,
48934921
4ADBF70036448B1395DC5657 /* leveldb_query_engine_test.cc in Sources */,
48944922
EE6DBFB0874A50578CE97A7F /* leveldb_remote_document_cache_test.cc in Sources */,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#import <FirebaseFirestore/FIRAggregateQuery.h>
18+
19+
#import <FirebaseFirestore/FIRQuery.h>
20+
21+
#import <XCTest/XCTest.h>
22+
23+
#import "Firestore/Source/API/FIRFirestore+Internal.h"
24+
#import "Firestore/Source/API/FIRQuery+Internal.h"
25+
26+
#import "Firestore/Example/Tests/API/FSTAPIHelpers.h"
27+
#import "Firestore/Example/Tests/Util/FSTHelpers.h"
28+
29+
#include "Firestore/core/src/core/query.h"
30+
#include "Firestore/core/test/unit/testutil/testutil.h"
31+
32+
namespace api = firebase::firestore::api;
33+
using firebase::firestore::testutil::Query;
34+
35+
NS_ASSUME_NONNULL_BEGIN
36+
37+
@interface FIRAggregateQueryUnitTests : XCTestCase
38+
@end
39+
40+
@implementation FIRAggregateQueryUnitTests
41+
42+
- (void)testEquals {
43+
std::shared_ptr<api::Firestore> firestore = FSTTestFirestore().wrapped;
44+
FIRAggregateQuery *queryFoo =
45+
[[FIRQuery alloc] initWithQuery:Query("foo") firestore:firestore].count;
46+
FIRAggregateQuery *queryFooDup =
47+
[[FIRQuery alloc] initWithQuery:Query("foo") firestore:firestore].count;
48+
FIRAggregateQuery *queryBar =
49+
[[FIRQuery alloc] initWithQuery:Query("bar") firestore:firestore].count;
50+
XCTAssertEqualObjects(queryFoo, queryFooDup);
51+
XCTAssertNotEqualObjects(queryFoo, queryBar);
52+
53+
XCTAssertEqual([queryFoo hash], [queryFooDup hash]);
54+
XCTAssertNotEqual([queryFoo hash], [queryBar hash]);
55+
}
56+
57+
@end
58+
59+
NS_ASSUME_NONNULL_END

Firestore/core/src/api/aggregate_query.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ void AggregateQuery::Get(CountQueryCallback&& callback) {
3434
std::move(callback));
3535
}
3636

37+
bool operator==(const AggregateQuery& lhs, const AggregateQuery& rhs) {
38+
return lhs.query() == rhs.query();
39+
}
40+
3741
} // namespace api
3842
} // namespace firestore
3943
} // namespace firebase

Firestore/core/src/api/aggregate_query.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class AggregateQuery {
4141
Query query_;
4242
};
4343

44+
bool operator==(const AggregateQuery& lhs, const AggregateQuery& rhs);
45+
46+
inline bool operator!=(const AggregateQuery& lhs, const AggregateQuery& rhs) {
47+
return !(lhs == rhs);
48+
}
49+
4450
} // namespace api
4551
} // namespace firestore
4652
} // namespace firebase

Firestore/core/test/unit/api/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ if(NOT FIREBASE_IOS_BUILD_TESTS)
1616
return()
1717
endif()
1818

19-
firebase_ios_add_test(
20-
firestore_api_test
21-
cc_compilation_test.cc
22-
load_bundle_task_test.cc
23-
settings_test.cc
24-
)
19+
file(GLOB sources *.cc)
20+
firebase_ios_add_test(firestore_api_test ${sources})
2521

2622
target_link_libraries(
2723
firestore_api_test PRIVATE

0 commit comments

Comments
 (0)