aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Model/FSTPathTests.mm
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-05 11:30:59 -0500
committerGravatar GitHub <noreply@github.com>2018-03-05 11:30:59 -0500
commit1c40e7aada6b32bbc621f06fb5f380149606a58d (patch)
tree6dee81f74f8a33d1beae915d9227caf28b8e2598 /Firestore/Example/Tests/Model/FSTPathTests.mm
parent9b5b4d876eb77e65b3246614855088be101eebf3 (diff)
add converters and port paths to FSTQuery (#869)
* add converters and fix FSTQuery.{h,m} only * address changes * a change forget to address * add a dummy function to make inline-only-library buildable
Diffstat (limited to 'Firestore/Example/Tests/Model/FSTPathTests.mm')
-rw-r--r--Firestore/Example/Tests/Model/FSTPathTests.mm24
1 files changed, 24 insertions, 0 deletions
diff --git a/Firestore/Example/Tests/Model/FSTPathTests.mm b/Firestore/Example/Tests/Model/FSTPathTests.mm
index 68bcc44..388c5c3 100644
--- a/Firestore/Example/Tests/Model/FSTPathTests.mm
+++ b/Firestore/Example/Tests/Model/FSTPathTests.mm
@@ -195,6 +195,30 @@ NS_ASSUME_NONNULL_BEGIN
XCTAssertEqualObjects([[pathHead pathByRemovingFirstSegment] canonicalString], @"bar");
}
+- (void)testRoundTrip {
+ FSTFieldPath *path = [FSTFieldPath pathWithSegments:@[ @"rooms", @"Eros", @"messages" ]];
+ XCTAssertEqualObjects(path, [FSTFieldPath fieldPathWithCPPFieldPath:[path toCPPFieldPath]]);
+
+ const firebase::firestore::model::FieldPath cppPath{"rooms", "Eros", "messages"};
+ XCTAssertEqual(cppPath, [[FSTFieldPath fieldPathWithCPPFieldPath:cppPath] toCPPFieldPath]);
+}
+
+@end
+
+@interface FSTResourcePathTests : XCTestCase
@end
+@implementation FSTResourcePathTests
+
+- (void)testRoundTrip {
+ FSTResourcePath *path = [FSTResourcePath pathWithSegments:@[ @"rooms", @"Eros", @"messages" ]];
+ XCTAssertEqualObjects(path,
+ [FSTResourcePath resourcePathWithCPPResourcePath:[path toCPPResourcePath]]);
+
+ const firebase::firestore::model::ResourcePath cppPath{"rooms", "Eros", "messages"};
+ XCTAssertEqual(cppPath,
+ [[FSTResourcePath resourcePathWithCPPResourcePath:cppPath] toCPPResourcePath]);
+}
+
+@end
NS_ASSUME_NONNULL_END