aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example/Database
diff options
context:
space:
mode:
Diffstat (limited to 'Example/Database')
-rw-r--r--Example/Database/Tests/Integration/FEventTests.m4
-rw-r--r--Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m20
2 files changed, 20 insertions, 4 deletions
diff --git a/Example/Database/Tests/Integration/FEventTests.m b/Example/Database/Tests/Integration/FEventTests.m
index 8b11e9d..cbd7f31 100644
--- a/Example/Database/Tests/Integration/FEventTests.m
+++ b/Example/Database/Tests/Integration/FEventTests.m
@@ -74,10 +74,6 @@
}
-- (void) testWriteTwoNestedLeafNodesChange {
-
-}
-
- (void) testSetMultipleEventListenersOnSameNode {
FTupleFirebase* tuple = [FTestHelpers getRandomNodePair];
diff --git a/Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m b/Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m
index 658a894..f26a913 100644
--- a/Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m
+++ b/Example/Database/Tests/Unit/FLevelDBStorageEngineTests.m
@@ -491,6 +491,26 @@
XCTAssertEqualObjects([[engine serverCacheAtPath:PATH(@"foo")] dataHash], hashFor247);
}
+- (void)testIntegersAreReturnedsAsIntegers {
+ id intValue = @247;
+ id longValue = @1542405709418655810;
+ id doubleValue = @0xFFFFFFFFFFFFFFFFUL; // This number can't be represented as a signed long.
+
+ id<FNode> expectedData = NODE((@{@"int": @247, @"long": longValue, @"double": doubleValue}));
+ FLevelDBStorageEngine *engine = [self cleanStorageEngine];
+ [engine updateServerCache:expectedData atPath:PATH(@"foo") merge:NO];
+ id<FNode> actualData = [engine serverCacheAtPath:PATH(@"foo")];
+ NSNumber* actualInt = [actualData val][@"int"];
+ NSNumber* actualLong = [actualData val][@"long"];
+ NSNumber* actualDouble = [actualData val][@"double"];
+
+ XCTAssertEqualObjects([actualInt stringValue], [intValue stringValue]);
+ XCTAssertEqual(CFNumberGetType((CFNumberRef)actualInt), kCFNumberSInt64Type);
+ XCTAssertEqualObjects([actualLong stringValue ], [longValue stringValue]);
+ XCTAssertEqual(CFNumberGetType((CFNumberRef)actualLong), kCFNumberSInt64Type);
+ XCTAssertEqual(CFNumberGetType((CFNumberRef)actualDouble), kCFNumberFloat64Type);
+}
+
// TODO[offline]: Somehow test estimated server size?
// TODO[offline]: Test pruning!