diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2019-03-18 17:21:42 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2019-03-18 22:12:43 -0700 |
commit | 40458177b7a03b32fd72ea7cdc685efc2349b6ac (patch) | |
tree | f563b7e01e7494b82d2584ceed60aab0da650604 /platform/ios/test | |
parent | 41b25e2aa205a54b916ba987c9c0ae600204ebfd (diff) | |
download | qtlocation-mapboxgl-40458177b7a03b32fd72ea7cdc685efc2349b6ac.tar.gz |
[ios] Deleted unused NSData category
Diffstat (limited to 'platform/ios/test')
-rw-r--r-- | platform/ios/test/MGLNSDataAdditionsTests.m | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/platform/ios/test/MGLNSDataAdditionsTests.m b/platform/ios/test/MGLNSDataAdditionsTests.m deleted file mode 100644 index 8d145be4a0..0000000000 --- a/platform/ios/test/MGLNSDataAdditionsTests.m +++ /dev/null @@ -1,48 +0,0 @@ -#import <XCTest/XCTest.h> - -#import "../../darwin/src/NSData+MGLAdditions.h" - -@interface MGLNSDataAdditionsTests : XCTestCase -@end - -@implementation MGLNSDataAdditionsTests - -- (void)testCompressDecompress -{ - NSArray *originalArray = [self mockDataWithCount:180]; - - NSData *originalData = [NSJSONSerialization dataWithJSONObject:originalArray options:0 error:nil]; - - NSData *compressedData = [originalData mgl_compressedData]; - NSData *decompressedData = [compressedData mgl_decompressedData]; - - NSArray *decompressedArray = [NSJSONSerialization JSONObjectWithData:decompressedData options:0 error:nil]; - - XCTAssertTrue([originalArray isEqualToArray:decompressedArray], @"originalArray and decompressedArray should be equal"); -} - -- (NSArray *)mockDataWithCount:(NSUInteger)count -{ - NSMutableArray *array = [NSMutableArray array]; - - for (NSUInteger i=0;i<count;i++) - { - [array addObject:@{@"lat": @([self safeValueBetween:-90 and:90]), - @"lng": @([self safeValueBetween:-180 and:180]), - @"timestamp": @((floor([NSDate date].timeIntervalSince1970) * 100) / 100)}]; - } - - return array; -} - -- (double)safeValueBetween:(double)lowerBound and:(double)upperBound -{ - return floor([self randomBetween:lowerBound and:upperBound] * 100 ) / 100; -} - -- (double)randomBetween:(double)lowerBound and:(double)upperBound -{ - return lowerBound * drand48() + upperBound * drand48(); -} - -@end |