From 190d706f1b215af990f96961cff17f98d3a0e9c8 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:17:53 -0500 Subject: [PATCH 1/3] add test --- .../Tests/Integration/API/FIRQueryTests.mm | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm index b1cd36a5c49..22d9bc85af9 100644 --- a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm +++ b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm @@ -896,6 +896,30 @@ - (void)testSdkOrdersQueryByDocumentIdTheSameWayOnlineAndOffline { ]]; } +- (void)testSnapshotListenerSortsNumbersSameWayAsServer { + FIRCollectionReference *collRef = [self collectionRefWithDocuments:@{ + @"intMin" : @{@"value" : @LLONG_MIN}, + @"doubleMin" : @{@"value" : @((double)LLONG_MIN - 100)}, + @"intMax" : @{@"value" : @LLONG_MAX}, + @"doubleMax" : @{@"value" : @((double)LLONG_MAX + 100)}, + @"NaN" : @{@"value" :[NSNumber numberWithFloat:NAN]}, + @"integerMax" : @{@"value" : @(INT_MAX)}, + @"integerMin" : @{@"value" : @(INT_MAX)}, + @"negativeInfinity" : @{@"value" : @(-INFINITY)}, + @"positiveInfinity" : @{@"value" : @(INFINITY)} + }]; + + FIRQuery *query = [collRef queryOrderedByField:@"value"]; + FIRQuerySnapshot *getSnapshot = [self readDocumentSetForRef:query]; + + id registration = + [query addSnapshotListener:self.eventAccumulator.valueEventHandler]; + FIRQuerySnapshot *watchSnapshot = [self.eventAccumulator awaitEventWithName:@"Snapshot"]; + XCTAssertEqualObjects(FIRQuerySnapshotGetIDs(watchSnapshot), FIRQuerySnapshotGetIDs(getSnapshot)); + + [registration remove]; +} + - (void)testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIDs { // Use .document() to get a random collection group name to use but ensure it starts with 'b' // for predictable ordering. From 5303d84e3b3b20ed8f8900ff1530b3563716cc81 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:19:32 -0500 Subject: [PATCH 2/3] format --- Firestore/Example/Tests/Integration/API/FIRQueryTests.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm index 22d9bc85af9..0f5627c95bf 100644 --- a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm +++ b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm @@ -902,7 +902,7 @@ - (void)testSnapshotListenerSortsNumbersSameWayAsServer { @"doubleMin" : @{@"value" : @((double)LLONG_MIN - 100)}, @"intMax" : @{@"value" : @LLONG_MAX}, @"doubleMax" : @{@"value" : @((double)LLONG_MAX + 100)}, - @"NaN" : @{@"value" :[NSNumber numberWithFloat:NAN]}, + @"NaN" : @{@"value" : [NSNumber numberWithFloat:NAN]}, @"integerMax" : @{@"value" : @(INT_MAX)}, @"integerMin" : @{@"value" : @(INT_MAX)}, @"negativeInfinity" : @{@"value" : @(-INFINITY)}, From b9859dc95ca648224c4e08f4f9082a67e70b55cd Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:15:26 -0500 Subject: [PATCH 3/3] Update FIRQueryTests.mm --- Firestore/Example/Tests/Integration/API/FIRQueryTests.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm index 0f5627c95bf..eb7541a32b1 100644 --- a/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm +++ b/Firestore/Example/Tests/Integration/API/FIRQueryTests.mm @@ -904,7 +904,7 @@ - (void)testSnapshotListenerSortsNumbersSameWayAsServer { @"doubleMax" : @{@"value" : @((double)LLONG_MAX + 100)}, @"NaN" : @{@"value" : [NSNumber numberWithFloat:NAN]}, @"integerMax" : @{@"value" : @(INT_MAX)}, - @"integerMin" : @{@"value" : @(INT_MAX)}, + @"integerMin" : @{@"value" : @(INT_MIN)}, @"negativeInfinity" : @{@"value" : @(-INFINITY)}, @"positiveInfinity" : @{@"value" : @(INFINITY)} }];