aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Util
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-05-01 13:37:53 -0400
committerGravatar GitHub <noreply@github.com>2018-05-01 13:37:53 -0400
commit4e1ffe464900a45915a3a0a4f2a331b5824c24df (patch)
treec3586f3d840f4b21a4e4643a46fe94f2443d3959 /Firestore/Example/Tests/Util
parent51be76700c3b71a0924e8eaf7bac4b02e0130e62 (diff)
Port `SnapshotVersion` for the rest Firestore modulo (#1185)
* remove conversions in `Local` and `Remote` * replace `FSTSnapshotVersion` in `Model` * replace `FSTSnapshotVersion` in the rest * let test check equal with C++ equal * fix newly added code * address changes
Diffstat (limited to 'Firestore/Example/Tests/Util')
-rw-r--r--Firestore/Example/Tests/Util/FSTHelpers.h4
-rw-r--r--Firestore/Example/Tests/Util/FSTHelpers.mm16
2 files changed, 2 insertions, 18 deletions
diff --git a/Firestore/Example/Tests/Util/FSTHelpers.h b/Firestore/Example/Tests/Util/FSTHelpers.h
index 131da2d..f80f163 100644
--- a/Firestore/Example/Tests/Util/FSTHelpers.h
+++ b/Firestore/Example/Tests/Util/FSTHelpers.h
@@ -40,7 +40,6 @@
@class FSTQuery;
@class FSTRemoteEvent;
@class FSTSetMutation;
-@class FSTSnapshotVersion;
@class FSTSortOrder;
@class FSTTargetChange;
@class FIRTimestamp;
@@ -188,9 +187,6 @@ FSTDocumentKeySet *FSTTestDocKeySet(NSArray<FSTDocumentKey *> *keys);
/** Allow tests to just use an int literal for versions. */
typedef int64_t FSTTestSnapshotVersion;
-/** A convenience method for creating snapshot versions for tests. */
-FSTSnapshotVersion *FSTTestVersion(FSTTestSnapshotVersion version);
-
/** A convenience method for creating docs for tests. */
FSTDocument *FSTTestDoc(const absl::string_view path,
FSTTestSnapshotVersion version,
diff --git a/Firestore/Example/Tests/Util/FSTHelpers.mm b/Firestore/Example/Tests/Util/FSTHelpers.mm
index 888a45f..92eb730 100644
--- a/Firestore/Example/Tests/Util/FSTHelpers.mm
+++ b/Firestore/Example/Tests/Util/FSTHelpers.mm
@@ -29,7 +29,6 @@
#import "Firestore/Source/API/FIRFieldPath+Internal.h"
#import "Firestore/Source/API/FSTUserDataConverter.h"
#import "Firestore/Source/Core/FSTQuery.h"
-#import "Firestore/Source/Core/FSTSnapshotVersion.h"
#import "Firestore/Source/Core/FSTView.h"
#import "Firestore/Source/Core/FSTViewSnapshot.h"
#import "Firestore/Source/Local/FSTLocalViewChanges.h"
@@ -73,9 +72,6 @@ NS_ASSUME_NONNULL_BEGIN
/** A string sentinel that can be used with FSTTestPatchMutation() to mark a field for deletion. */
static NSString *const kDeleteSentinel = @"<DELETE>";
-static const int kMicrosPerSec = 1000000;
-static const int kMillisPerSec = 1000;
-
FIRTimestamp *FSTTestTimestamp(int year, int month, int day, int hour, int minute, int second) {
NSDate *date = FSTTestDate(year, month, day, hour, minute, second);
return [FIRTimestamp timestampWithDate:date];
@@ -158,14 +154,6 @@ FSTDocumentKeySet *FSTTestDocKeySet(NSArray<FSTDocumentKey *> *keys) {
return result;
}
-FSTSnapshotVersion *FSTTestVersion(FSTTestSnapshotVersion versionMicroseconds) {
- int64_t seconds = versionMicroseconds / kMicrosPerSec;
- int32_t nanos = (int32_t)(versionMicroseconds % kMicrosPerSec) * kMillisPerSec;
-
- FIRTimestamp *timestamp = [[FIRTimestamp alloc] initWithSeconds:seconds nanoseconds:nanos];
- return [FSTSnapshotVersion versionWithTimestamp:timestamp];
-}
-
FSTDocument *FSTTestDoc(const absl::string_view path,
FSTTestSnapshotVersion version,
NSDictionary<NSString *, id> *data,
@@ -173,14 +161,14 @@ FSTDocument *FSTTestDoc(const absl::string_view path,
DocumentKey key = testutil::Key(path);
return [FSTDocument documentWithData:FSTTestObjectValue(data)
key:key
- version:FSTTestVersion(version)
+ version:testutil::Version(version)
hasLocalMutations:hasMutations];
}
FSTDeletedDocument *FSTTestDeletedDoc(const absl::string_view path,
FSTTestSnapshotVersion version) {
DocumentKey key = testutil::Key(path);
- return [FSTDeletedDocument documentWithKey:key version:FSTTestVersion(version)];
+ return [FSTDeletedDocument documentWithKey:key version:testutil::Version(version)];
}
FSTDocumentKeyReference *FSTTestRef(const absl::string_view projectID,