aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Util/FSTHelpers.mm
diff options
context:
space:
mode:
authorGravatar rsgowman <rgowman@google.com>2018-07-11 21:59:49 -0400
committerGravatar GitHub <noreply@github.com>2018-07-11 21:59:49 -0400
commit82ef0886bf89339bfe7a1855e697e61959eeb486 (patch)
tree67869be000dd249cf088ab899d96b250a16c2ca4 /Firestore/Example/Tests/Util/FSTHelpers.mm
parent7fc953fc6ffa69d159c0523d3902d867fe8c0ca5 (diff)
Move creation of FSTFilter objects to static create method on FSTFilter. (#1512)
Rather than previously inlining it in the calling code. This is to unify filter creation across platforms. (This change involves altering FSTFilter from a protocol to an abstract class.)
Diffstat (limited to 'Firestore/Example/Tests/Util/FSTHelpers.mm')
-rw-r--r--Firestore/Example/Tests/Util/FSTHelpers.mm13
1 files changed, 3 insertions, 10 deletions
diff --git a/Firestore/Example/Tests/Util/FSTHelpers.mm b/Firestore/Example/Tests/Util/FSTHelpers.mm
index 8ece82f..58513b0 100644
--- a/Firestore/Example/Tests/Util/FSTHelpers.mm
+++ b/Firestore/Example/Tests/Util/FSTHelpers.mm
@@ -179,7 +179,7 @@ FSTQuery *FSTTestQuery(const absl::string_view path) {
return [FSTQuery queryWithPath:testutil::Resource(path)];
}
-id<FSTFilter> FSTTestFilter(const absl::string_view field, NSString *opString, id value) {
+FSTFilter *FSTTestFilter(const absl::string_view field, NSString *opString, id value) {
const FieldPath path = testutil::Field(field);
FSTRelationFilterOperator op;
if ([opString isEqualToString:@"<"]) {
@@ -199,15 +199,8 @@ id<FSTFilter> FSTTestFilter(const absl::string_view field, NSString *opString, i
}
FSTFieldValue *data = FSTTestFieldValue(value);
- if ([data isEqual:[FSTDoubleValue nanValue]]) {
- HARD_ASSERT(op == FSTRelationFilterOperatorEqual, "Must use == with NAN.");
- return [[FSTNanFilter alloc] initWithField:path];
- } else if ([data isEqual:[FSTNullValue nullValue]]) {
- HARD_ASSERT(op == FSTRelationFilterOperatorEqual, "Must use == with Null.");
- return [[FSTNullFilter alloc] initWithField:path];
- } else {
- return [FSTRelationFilter filterWithField:path filterOperator:op value:data];
- }
+
+ return [FSTFilter filterWithField:path filterOperator:op value:data];
}
FSTSortOrder *FSTTestOrderBy(const absl::string_view field, NSString *direction) {