Skip to content

Commit

Permalink
Updated unit tests for ORKEmailAnswerFormat.
Browse files Browse the repository at this point in the history
  • Loading branch information
Umer Khan authored and Umer Khan committed Jul 7, 2015
1 parent 4e56c56 commit 12ef17e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ResearchKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
147503BA1AEE807C004B17F3 /* ORKToneAudiometryStep.m in Sources */ = {isa = PBXBuildFile; fileRef = 147503B41AEE807C004B17F3 /* ORKToneAudiometryStep.m */; };
147503BB1AEE807C004B17F3 /* ORKToneAudiometryStepViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 147503B51AEE807C004B17F3 /* ORKToneAudiometryStepViewController.h */; settings = {ATTRIBUTES = (Private, ); }; };
147503BC1AEE807C004B17F3 /* ORKToneAudiometryStepViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 147503B61AEE807C004B17F3 /* ORKToneAudiometryStepViewController.m */; };
248604061B4C98760010C8A0 /* ORKAnswerFormatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 248604051B4C98760010C8A0 /* ORKAnswerFormatTests.m */; };
25ECC0951AFBD68300F3D63B /* ORKReactionTimeStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 25ECC0931AFBD68300F3D63B /* ORKReactionTimeStep.h */; };
25ECC0961AFBD68300F3D63B /* ORKReactionTimeStep.m in Sources */ = {isa = PBXBuildFile; fileRef = 25ECC0941AFBD68300F3D63B /* ORKReactionTimeStep.m */; };
25ECC09B1AFBD8B300F3D63B /* ORKReactionTimeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 25ECC0991AFBD8B300F3D63B /* ORKReactionTimeViewController.h */; };
Expand Down Expand Up @@ -420,6 +421,7 @@
147503B41AEE807C004B17F3 /* ORKToneAudiometryStep.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ORKToneAudiometryStep.m; sourceTree = "<group>"; };
147503B51AEE807C004B17F3 /* ORKToneAudiometryStepViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ORKToneAudiometryStepViewController.h; sourceTree = "<group>"; };
147503B61AEE807C004B17F3 /* ORKToneAudiometryStepViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ORKToneAudiometryStepViewController.m; sourceTree = "<group>"; };
248604051B4C98760010C8A0 /* ORKAnswerFormatTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ORKAnswerFormatTests.m; sourceTree = "<group>"; };
25ECC0931AFBD68300F3D63B /* ORKReactionTimeStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ORKReactionTimeStep.h; sourceTree = "<group>"; };
25ECC0941AFBD68300F3D63B /* ORKReactionTimeStep.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ORKReactionTimeStep.m; sourceTree = "<group>"; };
25ECC0991AFBD8B300F3D63B /* ORKReactionTimeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ORKReactionTimeViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -992,6 +994,7 @@
FA7A9D351B09362D005A2BEA /* Consent */,
86CC8EA71AC09383001CCD89 /* Info.plist */,
86CC8EA81AC09383001CCD89 /* ORKAccessibilityTests.m */,
248604051B4C98760010C8A0 /* ORKAnswerFormatTests.m */,
86CC8EA91AC09383001CCD89 /* ORKChoiceAnswerFormatHelperTests.m */,
86CC8EAB1AC09383001CCD89 /* ORKDataLoggerManagerTests.m */,
86CC8EAC1AC09383001CCD89 /* ORKDataLoggerTests.m */,
Expand Down Expand Up @@ -2133,6 +2136,7 @@
buildActionMask = 2147483647;
files = (
86CC8EB71AC09383001CCD89 /* ORKDataLoggerTests.m in Sources */,
248604061B4C98760010C8A0 /* ORKAnswerFormatTests.m in Sources */,
86CC8EBA1AC09383001CCD89 /* ORKResultTests.m in Sources */,
FA7A9D391B0969A7005A2BEA /* ORKConsentSignatureFormatterTests.m in Sources */,
86CC8EB81AC09383001CCD89 /* ORKHKSampleTests.m in Sources */,
Expand Down
11 changes: 10 additions & 1 deletion ResearchKitTests/ORKAnswerFormatTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,21 @@ @implementation ORKAnswerFormatTests

- (void)testValidEmailAnswerFormat {
// Test email regex validation with correct input.
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssert([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
}

- (void)testInvalidEmailAnswerFormat {
// Test email regex validation with incorrect input.
XCTAssertFalse([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"emailtest"]);
XCTAssertFalse([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"emailtest@"]);
XCTAssertFalse([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"emailtest@researchkit"]);
XCTAssertFalse([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"[email protected]"]);
XCTAssertFalse([[ORKEmailAnswerFormat emailAnswerFormat] isAnswerValidWithString:@"12345"]);
}

@end

0 comments on commit 12ef17e

Please sign in to comment.