-
Notifications
You must be signed in to change notification settings - Fork 17
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 #65 from WideSpectrumComputing/master
Exploring AUL integration within unit tests
- Loading branch information
Showing
12 changed files
with
710 additions
and
9 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
44 changes: 44 additions & 0 deletions
44
RollbarNotifier/Sources/RollbarNotifier/RollbarAulLogLevelConverter.m
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,44 @@ | ||
// | ||
// RollbarAulLogLevelConverter.m | ||
// | ||
// | ||
// Created by Andrey Kornich on 2021-03-24. | ||
// | ||
|
||
#import "RollbarAulLogLevelConverter.h" | ||
|
||
@implementation RollbarAulLogLevelConverter | ||
|
||
+ (os_log_type_t) RollbarLevelToAulLevel:(RollbarLevel)value { | ||
|
||
switch (value) { | ||
case RollbarLevel_Debug: | ||
return OS_LOG_TYPE_DEBUG; | ||
case RollbarLevel_Info: | ||
return OS_LOG_TYPE_INFO; | ||
case RollbarLevel_Warning: | ||
return OS_LOG_TYPE_DEFAULT; | ||
case RollbarLevel_Error: | ||
return OS_LOG_TYPE_ERROR; | ||
case RollbarLevel_Critical: | ||
return OS_LOG_TYPE_FAULT; | ||
} | ||
} | ||
|
||
+ (RollbarLevel) RollbarLevelFromAulLevel:(os_log_type_t)value { | ||
|
||
switch (value) { | ||
case OS_LOG_TYPE_DEBUG: | ||
return RollbarLevel_Debug; | ||
case OS_LOG_TYPE_INFO: | ||
return RollbarLevel_Info; | ||
case OS_LOG_TYPE_ERROR: | ||
return RollbarLevel_Error; | ||
case OS_LOG_TYPE_FAULT: | ||
return RollbarLevel_Critical; | ||
case OS_LOG_TYPE_DEFAULT: | ||
return RollbarLevel_Warning; | ||
} | ||
} | ||
|
||
@end |
66 changes: 66 additions & 0 deletions
66
RollbarNotifier/Sources/RollbarNotifier/RollbarAulOSLogEntryLogLevelConverter.m
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,66 @@ | ||
// | ||
// RollbarAulOSLogEntryLogLevelConverter.m | ||
// | ||
// | ||
// Created by Andrey Kornich on 2021-03-24. | ||
// | ||
|
||
#import "RollbarAulOSLogEntryLogLevelConverter.h" | ||
|
||
@implementation RollbarAulOSLogEntryLogLevelConverter | ||
|
||
+ (OSLogEntryLogLevel) RollbarLevelToOSLogEntryLogLevel:(RollbarLevel)value { | ||
|
||
switch (value) { | ||
|
||
case RollbarLevel_Debug: | ||
return OSLogEntryLogLevelDebug; | ||
case RollbarLevel_Info: | ||
return OSLogEntryLogLevelInfo; | ||
case RollbarLevel_Warning: | ||
return OSLogEntryLogLevelNotice; | ||
case RollbarLevel_Error: | ||
return OSLogEntryLogLevelError; | ||
case RollbarLevel_Critical: | ||
return OSLogEntryLogLevelFault; | ||
} | ||
} | ||
|
||
+ (RollbarLevel) RollbarLevelFromOSLogEntryLogLevel:(OSLogEntryLogLevel)value { | ||
|
||
switch (value) { | ||
|
||
case OSLogEntryLogLevelUndefined: | ||
case OSLogEntryLogLevelDebug: | ||
return RollbarLevel_Debug; | ||
case OSLogEntryLogLevelInfo: | ||
return RollbarLevel_Info; | ||
case OSLogEntryLogLevelNotice: | ||
return RollbarLevel_Warning; | ||
case OSLogEntryLogLevelError: | ||
return RollbarLevel_Error; | ||
case OSLogEntryLogLevelFault: | ||
return RollbarLevel_Critical; | ||
} | ||
} | ||
|
||
+ (NSString *) OSLogEntryLogLevelToString:(OSLogEntryLogLevel)value { | ||
|
||
switch (value) { | ||
|
||
case OSLogEntryLogLevelUndefined: | ||
return @"OSLogEntryLogLevelUndefined"; | ||
case OSLogEntryLogLevelDebug: | ||
return @"OSLogEntryLogLevelDebug"; | ||
case OSLogEntryLogLevelInfo: | ||
return @"OSLogEntryLogLevelInfo"; | ||
case OSLogEntryLogLevelNotice: | ||
return @"OSLogEntryLogLevelNotice"; | ||
case OSLogEntryLogLevelError: | ||
return @"OSLogEntryLogLevelError"; | ||
case OSLogEntryLogLevelFault: | ||
return @"OSLogEntryLogLevelFault"; | ||
} | ||
} | ||
|
||
@end |
23 changes: 23 additions & 0 deletions
23
RollbarNotifier/Sources/RollbarNotifier/include/RollbarAulLogLevelConverter.h
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,23 @@ | ||
// | ||
// RollbarAulLogLevelConverter.h | ||
// | ||
// | ||
// Created by Andrey Kornich on 2021-03-24. | ||
// | ||
|
||
@import Foundation; | ||
@import OSLog; | ||
|
||
#import "RollbarLevel.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RollbarAulLogLevelConverter : NSObject | ||
|
||
+ (os_log_type_t) RollbarLevelToAulLevel:(RollbarLevel)value; | ||
|
||
+ (RollbarLevel) RollbarLevelFromAulLevel:(os_log_type_t)value; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
27 changes: 27 additions & 0 deletions
27
RollbarNotifier/Sources/RollbarNotifier/include/RollbarAulOSLogEntryLogLevelConverter.h
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,27 @@ | ||
// | ||
// RollbarAulOSLogEntryLogLevelConverter.h | ||
// | ||
// | ||
// Created by Andrey Kornich on 2021-03-24. | ||
// | ||
|
||
@import Foundation; | ||
@import OSLog; | ||
|
||
#import "RollbarLevel.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
API_AVAILABLE(macos(10.15)) | ||
API_UNAVAILABLE(ios, tvos, watchos) | ||
@interface RollbarAulOSLogEntryLogLevelConverter : NSObject | ||
|
||
+ (OSLogEntryLogLevel) RollbarLevelToOSLogEntryLogLevel:(RollbarLevel)value; | ||
|
||
+ (RollbarLevel) RollbarLevelFromOSLogEntryLogLevel:(OSLogEntryLogLevel)value; | ||
|
||
+ (NSString *) OSLogEntryLogLevelToString:(OSLogEntryLogLevel)value; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
67 changes: 67 additions & 0 deletions
67
RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarAulLogLevelConverterTests.m
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,67 @@ | ||
@import Foundation; | ||
@import OSLog; | ||
@import RollbarNotifier; | ||
|
||
#if !TARGET_OS_WATCH | ||
#import <XCTest/XCTest.h> | ||
|
||
@import RollbarNotifier; | ||
|
||
@interface RollbarAulLogLevelConverterTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation RollbarAulLogLevelConverterTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
} | ||
|
||
- (void)tearDown { | ||
[super tearDown]; | ||
} | ||
|
||
- (NSArray<NSNumber *> *) getOrederedAulLevels { | ||
|
||
return @[ | ||
|
||
[NSNumber numberWithUnsignedShort:OS_LOG_TYPE_DEBUG], | ||
[NSNumber numberWithUnsignedShort:OS_LOG_TYPE_INFO], | ||
[NSNumber numberWithUnsignedShort:OS_LOG_TYPE_DEFAULT], | ||
[NSNumber numberWithUnsignedShort:OS_LOG_TYPE_ERROR], | ||
[NSNumber numberWithUnsignedShort:OS_LOG_TYPE_FAULT] | ||
]; | ||
} | ||
|
||
- (NSArray<NSNumber *> *) getOrederedRollbarLevels { | ||
|
||
return @[ | ||
|
||
[NSNumber numberWithUnsignedLong:RollbarLevel_Debug], | ||
[NSNumber numberWithUnsignedLong:RollbarLevel_Info], | ||
[NSNumber numberWithUnsignedLong:RollbarLevel_Warning], | ||
[NSNumber numberWithUnsignedLong:RollbarLevel_Error], | ||
[NSNumber numberWithUnsignedLong:RollbarLevel_Critical] | ||
]; | ||
} | ||
|
||
- (void)testRollbarLevelFromAulLevel { | ||
|
||
XCTAssertEqual(RollbarLevel_Debug, [RollbarAulLogLevelConverter RollbarLevelFromAulLevel:OS_LOG_TYPE_DEBUG]); | ||
XCTAssertEqual(RollbarLevel_Info, [RollbarAulLogLevelConverter RollbarLevelFromAulLevel:OS_LOG_TYPE_INFO]); | ||
XCTAssertEqual(RollbarLevel_Warning, [RollbarAulLogLevelConverter RollbarLevelFromAulLevel:OS_LOG_TYPE_DEFAULT]); | ||
XCTAssertEqual(RollbarLevel_Error, [RollbarAulLogLevelConverter RollbarLevelFromAulLevel:OS_LOG_TYPE_ERROR]); | ||
XCTAssertEqual(RollbarLevel_Critical, [RollbarAulLogLevelConverter RollbarLevelFromAulLevel:OS_LOG_TYPE_FAULT]); | ||
} | ||
|
||
- (void)testRollbarLevelToAulLevel { | ||
|
||
XCTAssertEqual(OS_LOG_TYPE_DEBUG, [RollbarAulLogLevelConverter RollbarLevelToAulLevel:RollbarLevel_Debug]); | ||
XCTAssertEqual(OS_LOG_TYPE_INFO, [RollbarAulLogLevelConverter RollbarLevelToAulLevel:RollbarLevel_Info]); | ||
XCTAssertEqual(OS_LOG_TYPE_DEFAULT, [RollbarAulLogLevelConverter RollbarLevelToAulLevel:RollbarLevel_Warning]); | ||
XCTAssertEqual(OS_LOG_TYPE_ERROR, [RollbarAulLogLevelConverter RollbarLevelToAulLevel:RollbarLevel_Error]); | ||
XCTAssertEqual(OS_LOG_TYPE_FAULT, [RollbarAulLogLevelConverter RollbarLevelToAulLevel:RollbarLevel_Critical]); | ||
} | ||
|
||
@end | ||
#endif |
55 changes: 55 additions & 0 deletions
55
RollbarNotifier/Tests/RollbarNotifierTests-ObjC/RollbarAulOSLogEntryLogLevelConverterTests.m
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,55 @@ | ||
@import Foundation; | ||
@import OSLog; | ||
@import RollbarNotifier; | ||
|
||
#if !TARGET_OS_WATCH | ||
#import <XCTest/XCTest.h> | ||
|
||
@import RollbarNotifier; | ||
|
||
@interface RollbarAulOSLogEntryLogLevelConverterTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation RollbarAulOSLogEntryLogLevelConverterTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
} | ||
|
||
- (void)tearDown { | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testRollbarLevelFromOSLogEntryLogLevel { | ||
|
||
XCTAssertEqual(RollbarLevel_Debug, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelUndefined]); | ||
XCTAssertEqual(RollbarLevel_Debug, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelDebug]); | ||
XCTAssertEqual(RollbarLevel_Info, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelInfo]); | ||
XCTAssertEqual(RollbarLevel_Warning, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelNotice]); | ||
XCTAssertEqual(RollbarLevel_Error, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelError]); | ||
XCTAssertEqual(RollbarLevel_Critical, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelFromOSLogEntryLogLevel:OSLogEntryLogLevelFault]); | ||
} | ||
|
||
- (void)testRollbarLevelToOSLogEntryLogLevel { | ||
|
||
XCTAssertEqual(OSLogEntryLogLevelDebug, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelToOSLogEntryLogLevel:RollbarLevel_Debug]); | ||
XCTAssertEqual(OSLogEntryLogLevelInfo, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelToOSLogEntryLogLevel:RollbarLevel_Info]); | ||
XCTAssertEqual(OSLogEntryLogLevelNotice, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelToOSLogEntryLogLevel:RollbarLevel_Warning]); | ||
XCTAssertEqual(OSLogEntryLogLevelError, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelToOSLogEntryLogLevel:RollbarLevel_Error]); | ||
XCTAssertEqual(OSLogEntryLogLevelFault, | ||
[RollbarAulOSLogEntryLogLevelConverter RollbarLevelToOSLogEntryLogLevel:RollbarLevel_Critical]); | ||
} | ||
|
||
@end | ||
#endif |
Oops, something went wrong.