mirror of https://github.com/oxen-io/session-ios
Bloomfilter moves to Cache folder
The bloom filter is not user generated content so Apple is not going to let us store it into the Documents folder. Moving it to the Cache folder.pull/1/head
parent
50fa491c7b
commit
b6ef5f0b7f
@ -1 +1 @@
|
||||
Subproject commit 1569cfc9475da09be8d415fdc9194fdb2b6388f9
|
||||
Subproject commit 9aac93648cd42d0a94d9b04b8456f7183a8c3b8e
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
// BloomFilterTests.m
|
||||
// Signal
|
||||
//
|
||||
// Created by Frederic Jacobs on 11/03/15.
|
||||
// Copyright (c) 2015 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "Cryptography.h"
|
||||
#import "Environment.h"
|
||||
#import "PropertyListPreferences.h"
|
||||
|
||||
@interface PropertyListPreferences()
|
||||
- (NSData*)tryRetreiveBloomFilter;
|
||||
- (void)storeBloomfilter:(NSData*)bloomFilterData;
|
||||
@end
|
||||
|
||||
@interface BloomFilterTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation BloomFilterTests
|
||||
|
||||
- (void)tearDown{
|
||||
PropertyListPreferences *prefs = [Environment preferences];
|
||||
[prefs storeBloomfilter:nil];
|
||||
}
|
||||
|
||||
- (void)testCreationRetreivalDeletion{
|
||||
NSData *randomData = [Cryptography generateRandomBytes:30];
|
||||
PropertyListPreferences *prefs = [Environment preferences];
|
||||
|
||||
NSData *bloomFilter = [prefs tryRetreiveBloomFilter];
|
||||
|
||||
XCTAssert(bloomFilter == nil);
|
||||
|
||||
[prefs storeBloomfilter:randomData];
|
||||
bloomFilter = [prefs tryRetreiveBloomFilter];
|
||||
|
||||
XCTAssert([bloomFilter isEqualToData:randomData]);
|
||||
|
||||
[prefs storeBloomfilter:nil];
|
||||
bloomFilter = [prefs tryRetreiveBloomFilter];
|
||||
XCTAssert(bloomFilter == nil);
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue