-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from qonversion/release/1.1.0
Release/1.1.0
- Loading branch information
Showing
21 changed files
with
784 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#import <XCTest/XCTest.h> | ||
#import "QonversionProperties.h" | ||
|
||
@interface QonversionPropertiesTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation QonversionPropertiesTests | ||
|
||
- (void)testExample { | ||
XCTAssertEqualObjects([QonversionProperties keyForProperty:QPropertyEmail], @"_q_email"); | ||
} | ||
|
||
- (void)testCorrectionForPropertyKey { | ||
XCTAssertTrue([QonversionProperties checkProperty:@"test"]); | ||
XCTAssertTrue([QonversionProperties checkProperty:@"test-test"]); | ||
XCTAssertTrue([QonversionProperties checkProperty:@"test-test:"]); | ||
XCTAssertFalse([QonversionProperties checkProperty:@"test-test: "]); | ||
XCTAssertTrue([QonversionProperties checkProperty:@"test_test"]); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,5 @@ - (void)testThatDebugModeSetCorrectly { | |
XCTAssertEqual(debugMode, @YES); | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#import <XCTest/XCTest.h> | ||
#import "QInMemoryStorage.h" | ||
|
||
static NSString *const QInMemoryStorageKey = @"testStorageKey"; | ||
NSTimeInterval QDefaultTestTimeout = 0.1; | ||
|
||
@interface QInMemoryStorageTests : XCTestCase | ||
|
||
@property (nonatomic, strong) QInMemoryStorage *storage; | ||
|
||
@end | ||
|
||
@implementation QInMemoryStorageTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
self.storage = [QInMemoryStorage new]; | ||
} | ||
|
||
- (void)tearDown { | ||
self.storage = nil; | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testThatStorageKeepObjectWithoutKey { | ||
NSObject *expectedObject = [NSObject new]; | ||
|
||
[self.storage storeObject:expectedObject]; | ||
id resultObject = [self.storage loadObject]; | ||
|
||
XCTAssertEqualObjects(expectedObject, resultObject); | ||
} | ||
|
||
- (void)testThatStorageKeepObjectByKey { | ||
NSObject *expectedObject = [NSObject new]; | ||
|
||
[self.storage storeObject:expectedObject forKey:QInMemoryStorageKey]; | ||
id resultObject = [self.storage loadObjectForKey:QInMemoryStorageKey]; | ||
|
||
XCTAssertEqualObjects(expectedObject, resultObject); | ||
} | ||
|
||
- (void)testThatStorageKeepLastValue { | ||
NSObject *firstObject = [NSObject new]; | ||
NSObject *expectedObject = [NSObject new]; | ||
|
||
[self.storage storeObject:firstObject]; | ||
[self.storage storeObject:expectedObject]; | ||
id resultObject = [self.storage loadObject]; | ||
|
||
XCTAssertEqualObjects(expectedObject, resultObject); | ||
} | ||
|
||
- (void)testThatStorageRetunNilAfterRemoveObjectWithoutKey { | ||
NSObject *expectedObject = [NSObject new]; | ||
|
||
[self.storage storeObject:expectedObject]; | ||
[self.storage removeObject]; | ||
id resultObject = [self.storage loadObject]; | ||
|
||
XCTAssertNil(resultObject); | ||
} | ||
|
||
- (void)testThatStorageReturnNilAfterRemoveObjectByKey { | ||
NSObject *object = [NSObject new]; | ||
|
||
[self.storage storeObject:object forKey:QInMemoryStorageKey]; | ||
[self.storage removeObjectForKey:QInMemoryStorageKey]; | ||
id resultObject = [self.storage loadObjectForKey:QInMemoryStorageKey]; | ||
|
||
XCTAssertNil(resultObject); | ||
} | ||
|
||
- (void)testThatStorageReturnObjectWithoutKeyInCompletionBlock { | ||
NSObject *expectedObject = [NSObject new]; | ||
XCTestExpectation *expectation = [self expectationWithDescription:@"Completion block was called"]; | ||
|
||
[self.storage storeObject:expectedObject]; | ||
|
||
__block id resultObject; | ||
[self.storage loadObjectWithCompletion:^(id object) { | ||
resultObject = object; | ||
[expectation fulfill]; | ||
}]; | ||
|
||
[self waitForExpectationsWithTimeout:QDefaultTestTimeout | ||
handler:^(NSError * _Nullable error) { | ||
XCTAssertEqualObjects(expectedObject, resultObject); | ||
}]; | ||
} | ||
|
||
- (void)testThatStorageReturnObjectByKeyInCompletionBlock { | ||
NSObject *expectedObject = [NSObject new]; | ||
XCTestExpectation *expectation = [self expectationWithDescription:@"Completion block was called"]; | ||
|
||
[self.storage storeObject:expectedObject forKey:QInMemoryStorageKey]; | ||
|
||
__block id resultObject; | ||
[self.storage loadObjectForKey:QInMemoryStorageKey withCompletion:^(id object) { | ||
resultObject = object; | ||
[expectation fulfill]; | ||
}]; | ||
|
||
[self waitForExpectationsWithTimeout:QDefaultTestTimeout | ||
handler:^(NSError * _Nullable error) { | ||
XCTAssertEqualObjects(expectedObject, resultObject); | ||
}]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef QBlocksHelpers_h | ||
#define QBlocksHelpers_h | ||
|
||
#define run_block(block, ...) block ? block(__VA_ARGS__) : nil | ||
#define run_block_on_main(block, ...) if(block){\ | ||
if ([NSThread isMainThread]) {\ | ||
run_block(block, __VA_ARGS__);\ | ||
}\ | ||
else{\ | ||
dispatch_async(dispatch_get_main_queue(), ^{run_block(block,__VA_ARGS__);});\ | ||
}\ | ||
} | ||
|
||
#define run_block_on_bg(block, ...) if(block){\ | ||
if (![NSThread isMainThread]) {\ | ||
block(__VA_ARGS__);\ | ||
}\ | ||
else{\ | ||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{run_block(block,__VA_ARGS__);});\ | ||
}\ | ||
} | ||
|
||
|
||
#endif | ||
|
||
#ifndef QONVERSION_DEBUG | ||
#define QONVERSION_DEBUG 1 | ||
#endif | ||
|
||
#ifndef QONVERSION_LOG | ||
#if QONVERSION_DEBUG | ||
# define QONVERSION_LOG(fmt, ...) NSLog(fmt, ##__VA_ARGS__) | ||
#else | ||
# define QONVERSION_LOG(...) | ||
#endif | ||
#endif | ||
|
||
#ifndef QONVERSION_LOG_ERRORS | ||
#define QONVERSION_LOG_ERRORS 1 | ||
#endif | ||
|
||
#ifndef QONVERSION_ERROR | ||
#if QONVERSION_LOG_ERRORS | ||
# define QONVERSION_ERROR(fmt, ...) NSLog(fmt, ##__VA_ARGS__) | ||
#else | ||
# define QONVERSION_ERROR(...) | ||
#endif | ||
#endif | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface QUtils : NSObject | ||
|
||
+ (BOOL)isEmptyString:(NSString*)string; | ||
|
||
@end |
Oops, something went wrong.