Skip to content

Commit bf8bffd

Browse files
committed
query_main.cc: IsBefore(BoundPosition) -> IsInclusive(BoundPosition)
This fixes several test failures due to incorrect handling of startAfter and endBefore resulting from a change in core::Bound from "before" to "inclusive" in firebase/firebase-ios-sdk#9519 Namely, this fixes the following failure: ``` cursor_test.cc:250: Failure Expected equality of these values: std::vector<std::string>({"c", "f", "b", "e"}) Which is: { "c", "f", "b", "e" } QuerySnapshotToIds(snapshot) Which is: { "c", "f" } [ FAILED ] FirestoreIntegrationTest.TimestampsCanBePassedToQueriesAsLimits ``` e.g. https://github.com/firebase/firebase-cpp-sdk/runs/6044737005
1 parent 7e229e8 commit bf8bffd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

firestore/src/main/query_main.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ core::Bound QueryInternal::ToBound(
227227
components->values[i] = *DeepClone(*value).release();
228228
}
229229

230-
return core::Bound::FromValue(std::move(components), IsBefore(bound_pos));
230+
return core::Bound::FromValue(std::move(components), IsInclusive(bound_pos));
231231
}
232232

233233
core::Bound QueryInternal::ToBound(
@@ -261,7 +261,7 @@ core::Bound QueryInternal::ToBound(
261261
}
262262
}
263263

264-
return core::Bound::FromValue(std::move(components), IsBefore(bound_pos));
264+
return core::Bound::FromValue(std::move(components), IsInclusive(bound_pos));
265265
}
266266

267267
Message<google_firestore_v1_Value> QueryInternal::ConvertDocumentId(
@@ -327,14 +327,14 @@ api::Query QueryInternal::CreateQueryWithBound(BoundPosition bound_pos,
327327
FIRESTORE_UNREACHABLE();
328328
}
329329

330-
bool QueryInternal::IsBefore(BoundPosition bound_pos) {
330+
bool QueryInternal::IsInclusive(BoundPosition bound_pos) {
331331
switch (bound_pos) {
332332
case BoundPosition::kStartAt:
333-
case BoundPosition::kEndBefore:
333+
case BoundPosition::kEndAt:
334334
return true;
335335

336336
case BoundPosition::kStartAfter:
337-
case BoundPosition::kEndAt:
337+
case BoundPosition::kEndBefore:
338338
return false;
339339
}
340340

firestore/src/main/query_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class QueryInternal {
201201
const nanopb::Message<google_firestore_v1_Value>& from,
202202
const core::Query& internal_query) const;
203203

204-
static bool IsBefore(BoundPosition bound_pos);
204+
static bool IsInclusive(BoundPosition bound_pos);
205205

206206
core::Bound ToBound(BoundPosition bound_pos,
207207
const DocumentSnapshot& public_snapshot) const;

0 commit comments

Comments
 (0)