Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for comparing cross type numbers #14283

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Firestore/Example/Tests/Integration/API/FIRQueryTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<FIRListenerRegistration> 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.
Expand Down
Loading