Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding new category tests.

  • Loading branch information...
commit 4ee079aee726e23a3a63229a141cf1c8f5f2f0f4 1 parent e1ed237
Devin Ross authored
39 src/NSArrayTests.h
View
@@ -0,0 +1,39 @@
+//
+// NSArrayTests.h
+// Created by Devin on 7/18/12.
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+
+#import <SenTestingKit/SenTestingKit.h>
+#import <Foundation/Foundation.h>
+#import "NSArray+TKCategory.h"
+
+@interface NSArrayTests : SenTestCase
+
+@end
50 src/NSArrayTests.m
View
@@ -0,0 +1,50 @@
+//
+// NSArrayTests.m
+// Created by Devin on 7/18/12.
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+
+#import "NSArrayTests.h"
+
+@implementation NSArrayTests
+
+
+- (void) tesFirstObject{
+
+
+ STAssertNil([[NSArray array] firstObject],nil);
+
+ NSArray *ar = [NSArray arrayWithObjects:@"BOB",nil];
+ STAssertEqualObjects([ar firstObject], @"BOB", nil);
+
+
+}
+
+
+@end
20 src/TapkuLibrary.xcodeproj/project.pbxproj
View
@@ -19,6 +19,10 @@
3B1DCECB1289B84400884CDF /* NSArray+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B1DCEC91289B84400884CDF /* NSArray+TKCategory.m */; };
3B4346E412DA6A240076579B /* UIButton+TKCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B4346E212DA6A240076579B /* UIButton+TKCategory.h */; };
3B4346E512DA6A240076579B /* UIButton+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B4346E312DA6A240076579B /* UIButton+TKCategory.m */; };
+ 3B4438A815B73C690069AAA3 /* NSStringTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B4438A715B73C690069AAA3 /* NSStringTests.m */; };
+ 3B4438BA15B74A990069AAA3 /* UIViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B4438B915B74A990069AAA3 /* UIViewTests.m */; };
+ 3B4438C115B74C920069AAA3 /* UIView+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A2210953E5200F235F1 /* UIView+TKCategory.m */; };
+ 3B4438C415B74E180069AAA3 /* NSArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B4438C315B74E180069AAA3 /* NSArrayTests.m */; };
3B560B7214574E30005FBDBF /* TKImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B560B7014574E30005FBDBF /* TKImageCache.h */; };
3B560B7314574E30005FBDBF /* TKImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B560B7114574E30005FBDBF /* TKImageCache.m */; };
3B6EDDD311547BEB00E454DA /* TapkuLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A1B10953E5200F235F1 /* TapkuLibrary.h */; };
@@ -129,6 +133,12 @@
3B1DCEC91289B84400884CDF /* NSArray+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+TKCategory.m"; sourceTree = "<group>"; };
3B4346E212DA6A240076579B /* UIButton+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+TKCategory.h"; sourceTree = "<group>"; };
3B4346E312DA6A240076579B /* UIButton+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+TKCategory.m"; sourceTree = "<group>"; };
+ 3B4438A615B73C690069AAA3 /* NSStringTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSStringTests.h; path = Tests/NSStringTests.h; sourceTree = SOURCE_ROOT; };
+ 3B4438A715B73C690069AAA3 /* NSStringTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSStringTests.m; path = Tests/NSStringTests.m; sourceTree = SOURCE_ROOT; };
+ 3B4438B815B74A990069AAA3 /* UIViewTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIViewTests.h; path = Tests/UIViewTests.h; sourceTree = "<group>"; };
+ 3B4438B915B74A990069AAA3 /* UIViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIViewTests.m; path = Tests/UIViewTests.m; sourceTree = "<group>"; };
+ 3B4438C215B74E180069AAA3 /* NSArrayTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSArrayTests.h; sourceTree = "<group>"; };
+ 3B4438C315B74E180069AAA3 /* NSArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSArrayTests.m; sourceTree = "<group>"; };
3B45DDF1134C736600D24C1A /* LogicTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LogicTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
3B45DDF2134C736600D24C1A /* LogicTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LogicTests-Info.plist"; sourceTree = "<group>"; };
3B560B7014574E30005FBDBF /* TKImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKImageCache.h; sourceTree = "<group>"; };
@@ -313,6 +323,12 @@
3B45DDF2134C736600D24C1A /* LogicTests-Info.plist */,
3B891629134D93D000BD2B31 /* FoundationTests.h */,
3B89162A134D93D000BD2B31 /* FoundationTests.m */,
+ 3B4438A615B73C690069AAA3 /* NSStringTests.h */,
+ 3B4438A715B73C690069AAA3 /* NSStringTests.m */,
+ 3B4438B815B74A990069AAA3 /* UIViewTests.h */,
+ 3B4438B915B74A990069AAA3 /* UIViewTests.m */,
+ 3B4438C215B74E180069AAA3 /* NSArrayTests.h */,
+ 3B4438C315B74E180069AAA3 /* NSArrayTests.m */,
);
name = UnitTests;
sourceTree = "<group>";
@@ -663,10 +679,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 3B4438C115B74C920069AAA3 /* UIView+TKCategory.m in Sources */,
3B859F02134C76C600661088 /* NSArray+TKCategory.m in Sources */,
3B859F03134C76C700661088 /* NSDate+TKCategory.m in Sources */,
3B859F08134C76D500661088 /* NSString+TKCategory.m in Sources */,
3B89162B134D93D000BD2B31 /* FoundationTests.m in Sources */,
+ 3B4438A815B73C690069AAA3 /* NSStringTests.m in Sources */,
+ 3B4438BA15B74A990069AAA3 /* UIViewTests.m in Sources */,
+ 3B4438C415B74E180069AAA3 /* NSArrayTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BIN  ...uLibrary.xcodeproj/project.xcworkspace/xcuserdata/devinross14.xcuserdatad/UserInterfaceState.xcuserstate
View
Binary file not shown
3  src/TapkuLibrary.xcodeproj/xcuserdata/devinross14.xcuserdatad/xcschemes/TapkuLibrary.xcscheme
View
@@ -42,7 +42,7 @@
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
launchStyle = "0"
@@ -50,6 +50,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
+ enableOpenGLFrameCaptureMode = "0"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
5 src/TapkuLibrary.xcodeproj/xcuserdata/devinross14.xcuserdatad/xcschemes/xcschememanagement.plist
View
@@ -4,6 +4,11 @@
<dict>
<key>SchemeUserState</key>
<dict>
+ <key>LogicTests.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>2</integer>
+ </dict>
<key>TapkuLibrary.xcscheme</key>
<dict>
<key>orderHint</key>
3  src/TapkuLibrary/UIView+TKCategory.m
View
@@ -35,8 +35,7 @@ @implementation UIView (TKCategory)
- (void) addSubviewToBack:(UIView*)view{
- [self addSubview:view];
- [self sendSubviewToBack:view];
+ [self insertSubview:view atIndex:0];
}
4 src/Tests/FoundationTests.h
View
@@ -35,15 +35,11 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
-#import "NSString+TKCategory.h"
#import "NSDate+TKCategory.h"
-#import "NSArray+TKCategory.h"
@interface FoundationTests : SenTestCase
-- (void) testStringCategory;
- (void) testDateCategory;
-- (void) testArrayCategory;
@end
37 src/Tests/FoundationTests.m
View
@@ -33,32 +33,7 @@
@implementation FoundationTests
-- (void) testStringCategory{
-
- NSString *string;
-
-
- string = @"bob@sanders.com";
- STAssertTrue([string isEmail], @"Expected '%@' to be a valid email", string);
-
-
- string = @"ao123sda.b2132Ob@sAND123123dsadrs.c";
- STAssertTrue([string isEmail], @"Expected '%@' to be a valid email", string);
-
-
- string = @"ao,sda.bOb@sANDdsadrs.c";
- STAssertFalse([string isEmail], @"Expected '%@' to be an invalid email", string);
-
- string = @"";
- STAssertFalse([string isEmail], @"Expected '%@' to be an invalid email", string);
-
-
- string = @"@b.d";
- STAssertFalse([string isEmail], @"Expected '%@' to be an invalid email", string);
-
-
-
-}
+
- (void) testDateCategory{
NSDate *date,*date2;
@@ -92,16 +67,6 @@ - (void) testDateCategory{
}
-- (void) testArrayCategory{
-
-
- STAssertThrows([[NSArray array] firstObject],@"Throws exception because empty arrays don't have objects");
-
- NSArray *ar = [NSArray arrayWithObjects:@"BOB",nil];
- STAssertNoThrow([ar firstObject],@"Doesn't throw exception.");
-
-
-}
@end
38 src/Tests/NSStringTests.h
View
@@ -0,0 +1,38 @@
+//
+// String.h
+// Created by Devin on 7/18/12.
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+#import <SenTestingKit/SenTestingKit.h>
+#import <Foundation/Foundation.h>
+#import "NSString+TKCategory.h"
+
+@interface NSStringTests : SenTestCase
+
+@end
70 src/Tests/NSStringTests.m
View
@@ -0,0 +1,70 @@
+//
+// String.m
+// Created by Devin on 7/18/12.
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+#import "NSStringTests.h"
+
+@implementation NSStringTests
+
+
+- (void) testEmail{
+
+ STAssertTrue([@"bob@sanders.com" isEmail], @"Expected to be a valid email");
+ STAssertTrue([@"ao123sda.b2132Ob@sAND123123dsadrs.c" isEmail], @"Expected to be a valid email");
+
+ STAssertFalse([@"ao,sda.bOb@sANDdsadrs.c" isEmail], @"Expected to be an invalid email");
+ STAssertFalse([@"" isEmail], @"Expected to be an invalid email");
+ STAssertFalse([@"@b.d" isEmail], @"Expected to be an invalid email");
+
+}
+
+- (void) testMD5Sum{
+ STAssertEqualObjects([@"password" md5sum], @"5f4dcc3b5aa765d61d8327deb882cf99", nil);
+ STAssertEqualObjects([@"devin" md5sum], @"11ef1590a74e1ab26c31a4e13f52d71b", nil);
+}
+
+
+- (void) testURLEncode{
+ STAssertEqualObjects([@"Bob Sanders" URLEncode], @"Bob%20Sanders", nil);
+ STAssertEqualObjects([@"\"Aardvarks lurk, OK?\"" URLEncode], @"%22Aardvarks%20lurk%2C%20OK%3F%22", nil);
+}
+
+
+- (void) testHasString{
+
+ STAssertTrue([@"Bob Sanders" hasString:@"Sanders"], nil);
+
+ STAssertFalse([@"Bob Sanders" hasString:@"SANDERS"], nil);
+ STAssertFalse([@"Bob Sanders" hasString:@"Cooper"], nil);
+
+}
+
+
+@end
40 src/Tests/UIViewTests.h
View
@@ -0,0 +1,40 @@
+//
+// UIViewTests.h
+// Created by Devin on 7/18/12.
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+#import <SenTestingKit/SenTestingKit.h>
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+#import <QuartzCore/QuartzCore.h>
+#import "UIView+TKCategory.h"
+
+@interface UIViewTests : SenTestCase
+
+@end
53 src/Tests/UIViewTests.m
View
@@ -0,0 +1,53 @@
+//
+// UIViewTests.m
+// Created by Devin on 7/18/12.
+//
+//
+/*
+
+ tapku.com || https://github.com/devinross/tapkulibrary
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ */
+
+#import "UIViewTests.h"
+
+@implementation UIViewTests
+
+- (void) testAddSubviewToBack{
+
+ CGRect zero = CGRectMake(0, 0, 0, 0);
+
+ UIView *superview = [[UIView alloc] initWithFrame:zero];
+ UIView *one = [[UIView alloc] initWithFrame:zero];
+ UIView *two = [[UIView alloc] initWithFrame:zero];
+ UIView *three = [[UIView alloc] initWithFrame:zero];
+
+ [superview addSubview:one];
+ [superview addSubview:two];
+ [superview addSubviewToBack:three];
+
+ STAssertTrue([superview.subviews objectAtIndex:0] == three, nil);
+}
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.