@@ -537,6 +537,35 @@ - (void)testQueriesCanUseNotEqualFiltersWithDocIds {
537537 (@[ testDocs[@" ab" ], testDocs[@" ba" ], testDocs[@" bb" ] ]));
538538}
539539
540+ - (void )testSDKUsesNotEqualFiltersSameAsServer {
541+ NSDictionary *testDocs = @{
542+ @" a" : @{@" zip" : @(NAN)},
543+ @" b" : @{@" zip" : @91102 },
544+ @" c" : @{@" zip" : @98101 },
545+ @" d" : @{@" zip" : @" 98101" },
546+ @" e" : @{@" zip" : @[ @98101 ]},
547+ @" f" : @{@" zip" : @[ @98101 , @98102 ]},
548+ @" g" : @{@" zip" : @[ @" 98101" , @{@" zip" : @98101 } ]},
549+ @" h" : @{@" zip" : @{@" code" : @500 }},
550+ @" i" : @{@" zip" : [NSNull null ]},
551+ @" j" : @{@" code" : @500 },
552+ };
553+ FIRCollectionReference *collection = [self collectionRefWithDocuments: testDocs];
554+
555+ // populate cache with all documents first to ensure getDocsFromCache() scans all docs
556+ [self readDocumentSetForRef: collection];
557+
558+ [self checkOnlineAndOfflineQuery: [collection queryWhereField: @" zip" isNotEqualTo: @98101 ]
559+ matchesResult: @[ @" a" , @" b" , @" d" , @" e" , @" f" , @" g" , @" h" ]];
560+
561+ [self checkOnlineAndOfflineQuery: [collection queryWhereField: @" zip" isNotEqualTo: @(NAN)]
562+ matchesResult: @[ @" b" , @" c" , @" d" , @" e" , @" f" , @" g" , @" h" ]];
563+
564+ [self checkOnlineAndOfflineQuery: [collection queryWhereField: @" zip"
565+ isNotEqualTo: @[ [NSNull null ] ]]
566+ matchesResult: @[ @" a" , @" b" , @" c" , @" d" , @" e" , @" f" , @" g" , @" h" ]];
567+ }
568+
540569- (void )testQueriesCanUseArrayContainsFilters {
541570 NSDictionary *testDocs = @{
542571 @" a" : @{@" array" : @[ @42 ]},
@@ -694,6 +723,33 @@ - (void)testQueriesCanUseNotInFiltersWithDocIds {
694723 XCTAssertEqualObjects (FIRQuerySnapshotGetData (snapshot), (@[ testDocs[@" ba" ], testDocs[@" bb" ] ]));
695724}
696725
726+ - (void )testSDKUsesNotInFiltersSameAsServer {
727+ NSDictionary *testDocs = @{
728+ @" a" : @{@" zip" : @(NAN)},
729+ @" b" : @{@" zip" : @91102 },
730+ @" c" : @{@" zip" : @98101 },
731+ @" d" : @{@" zip" : @" 98101" },
732+ @" e" : @{@" zip" : @[ @98101 ]},
733+ @" f" : @{@" zip" : @[ @98101 , @98102 ]},
734+ @" g" : @{@" zip" : @[ @" 98101" , @{@" zip" : @98101 } ]},
735+ @" h" : @{@" zip" : @{@" code" : @500 }},
736+ @" i" : @{@" zip" : [NSNull null ]},
737+ @" j" : @{@" code" : @500 },
738+ };
739+ FIRCollectionReference *collection = [self collectionRefWithDocuments: testDocs];
740+
741+ // populate cache with all documents first to ensure getDocsFromCache() scans all docs
742+ [self readDocumentSetForRef: collection];
743+
744+ [self checkOnlineAndOfflineQuery: [collection
745+ queryWhereField: @" zip"
746+ notIn: @[ @98101 , @98103 , @[ @98101 , @98102 ] ]]
747+ matchesResult: @[ @" a" , @" b" , @" d" , @" e" , @" g" , @" h" ]];
748+
749+ [self checkOnlineAndOfflineQuery: [collection queryWhereField: @" zip" notIn: @[ [NSNull null ] ]]
750+ matchesResult: @[]];
751+ }
752+
697753- (void )testQueriesCanUseArrayContainsAnyFilters {
698754 NSDictionary *testDocs = @{
699755 @" a" : @{@" array" : @[ @42 ]},
0 commit comments