Skip to content

FIX: sort strings in UTF-8 encoded byte order #14312

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

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
format
  • Loading branch information
milaGGL committed Jan 7, 2025
commit 0c5a93d853046fa7fa03db5406ede1b9b060625b
35 changes: 17 additions & 18 deletions Firestore/Example/Tests/Integration/API/FIRQueryTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -898,19 +898,18 @@ - (void)testSdkOrdersQueryByDocumentIdTheSameWayOnlineAndOffline {

- (void)testSnapshotListenerSortsUnicodeStringsInTheSameOrderAsServer {
FIRCollectionReference *collRef = [self collectionRefWithDocuments:@{
@"a": @{@"value": @ "Łukasiewicz"},
@"b": @{@"value": @"Sierpiński"},
@"c": @{@"value": @"岩澤"},
@"d": @{@"value": @"🄟"},
@"e": @{@"value": @"P"},
@"f": @{@"value": @"︒"},
@"g": @{@"value": @"🐵"}
@"a" : @{@"value" : @ "Łukasiewicz"},
@"b" : @{@"value" : @"Sierpiński"},
@"c" : @{@"value" : @"岩澤"},
@"d" : @{@"value" : @"🄟"},
@"e" : @{@"value" : @"P"},
@"f" : @{@"value" : @"︒"},
@"g" : @{@"value" : @"🐵"}

}];

FIRQuery *query = [collRef queryOrderedByField:@"value"];
NSArray<NSString *> *expectedDocs =
@[ @"b", @"a", @"c", @"f", @"e", @"d", @"g"];
NSArray<NSString *> *expectedDocs = @[ @"b", @"a", @"c", @"f", @"e", @"d", @"g" ];
FIRQuerySnapshot *getSnapshot = [self readDocumentSetForRef:query];
XCTAssertEqualObjects(FIRQuerySnapshotGetIDs(getSnapshot), expectedDocs);

Expand All @@ -924,18 +923,18 @@ - (void)testSnapshotListenerSortsUnicodeStringsInTheSameOrderAsServer {

- (void)testSnapshotListenerSortsUnicodeStringsTheSameWayOnlineAndOffline {
FIRCollectionReference *collRef = [self collectionRefWithDocuments:@{
@"a": @{@"value": @ "Łukasiewicz"},
@"b": @{@"value": @"Sierpiński"},
@"c": @{@"value": @"岩澤"},
@"d": @{@"value": @"🄟"},
@"e": @{@"value": @"P"},
@"f": @{@"value": @"︒"},
@"g": @{@"value": @"🐵"}
@"a" : @{@"value" : @ "Łukasiewicz"},
@"b" : @{@"value" : @"Sierpiński"},
@"c" : @{@"value" : @"岩澤"},
@"d" : @{@"value" : @"🄟"},
@"e" : @{@"value" : @"P"},
@"f" : @{@"value" : @"︒"},
@"g" : @{@"value" : @"🐵"}

}];

[self checkOnlineAndOfflineQuery:[collRef queryOrderedByField:@"value"]
matchesResult:@[@"b", @"a", @"c", @"f", @"e", @"d", @"g"]];
matchesResult:@[ @"b", @"a", @"c", @"f", @"e", @"d", @"g" ]];
}

- (void)testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIDs {
Expand Down
Loading