aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Model
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-06 14:28:04 -0500
committerGravatar GitHub <noreply@github.com>2018-03-06 14:28:04 -0500
commit8311c6432ecff78bedd13e27f64d241659324786 (patch)
tree982484ba69cf17172ee4e1308254a0b76894b7d5 /Firestore/Example/Tests/Model
parent34ebf10b0acc65f1924d723e82085d4104bc281d (diff)
port paths to FSTDocumentKey (#877)
* replace path with C++ implementation in FSTDocumentKey.{h,mm} only * address changes * address changes
Diffstat (limited to 'Firestore/Example/Tests/Model')
-rw-r--r--Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm21
1 files changed, 11 insertions, 10 deletions
diff --git a/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm b/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm
index d66ee73..5992b42 100644
--- a/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm
+++ b/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm
@@ -18,7 +18,9 @@
#import <XCTest/XCTest.h>
-#import "Firestore/Source/Model/FSTPath.h"
+#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
+
+using firebase::firestore::model::ResourcePath;
NS_ASSUME_NONNULL_BEGIN
@@ -28,23 +30,22 @@ NS_ASSUME_NONNULL_BEGIN
@implementation FSTDocumentKeyTests
- (void)testConstructor {
- FSTResourcePath *path =
- [FSTResourcePath pathWithSegments:@[ @"rooms", @"firestore", @"messages", @"1" ]];
+ ResourcePath path{"rooms", "firestore", "messages", "1"};
FSTDocumentKey *key = [FSTDocumentKey keyWithPath:path];
XCTAssertEqual(path, key.path);
}
- (void)testComparison {
- FSTDocumentKey *key1 = [FSTDocumentKey keyWithSegments:@[ @"a", @"b", @"c", @"d" ]];
- FSTDocumentKey *key2 = [FSTDocumentKey keyWithSegments:@[ @"a", @"b", @"c", @"d" ]];
- FSTDocumentKey *key3 = [FSTDocumentKey keyWithSegments:@[ @"x", @"y", @"z", @"w" ]];
+ FSTDocumentKey *key1 = [FSTDocumentKey keyWithSegments:{"a", "b", "c", "d"}];
+ FSTDocumentKey *key2 = [FSTDocumentKey keyWithSegments:{"a", "b", "c", "d"}];
+ FSTDocumentKey *key3 = [FSTDocumentKey keyWithSegments:{"x", "y", "z", "w"}];
XCTAssertTrue([key1 isEqualToKey:key2]);
XCTAssertFalse([key1 isEqualToKey:key3]);
- FSTDocumentKey *empty = [FSTDocumentKey keyWithSegments:@[]];
- FSTDocumentKey *a = [FSTDocumentKey keyWithSegments:@[ @"a", @"a" ]];
- FSTDocumentKey *b = [FSTDocumentKey keyWithSegments:@[ @"b", @"b" ]];
- FSTDocumentKey *ab = [FSTDocumentKey keyWithSegments:@[ @"a", @"a", @"b", @"b" ]];
+ FSTDocumentKey *empty = [FSTDocumentKey keyWithSegments:{}];
+ FSTDocumentKey *a = [FSTDocumentKey keyWithSegments:{"a", "a"}];
+ FSTDocumentKey *b = [FSTDocumentKey keyWithSegments:{"b", "b"}];
+ FSTDocumentKey *ab = [FSTDocumentKey keyWithSegments:{"a", "a", "b", "b"}];
XCTAssertEqual(NSOrderedAscending, [empty compare:a]);
XCTAssertEqual(NSOrderedAscending, [a compare:b]);