Created
August 5, 2012 10:11
-
-
Save marcphilipp/3263627 to your computer and use it in GitHub Desktop.
Objective-C Intro @ SoCraTes 2012 (by Johannes Seitz)
This file contains hidden or 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
// | |
// primefactorsTests.h | |
// primefactorsTests | |
// | |
// Created by Marc Philipp on 04.08.12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import <SenTestingKit/SenTestingKit.h> | |
@interface PrimefactorsTests : SenTestCase | |
@end |
This file contains hidden or 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
// | |
// primefactorsTests.m | |
// primefactorsTests | |
// | |
// Created by Marc Philipp on 04.08.12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import "PrimefactorsTests.h" | |
@interface PrimeFactors : NSObject | |
@end | |
@implementation PrimeFactors | |
-(id) initMyClass | |
{ | |
self = [super init]; | |
if (self != nil) { | |
} | |
return self; | |
} | |
-(NSArray *)factorsOf:(int) aNumber | |
{ | |
return [[[NSArray alloc] init] autorelease]; | |
} | |
@end | |
@implementation NSString (MyCategory) | |
+(NSString*)myName | |
{ | |
return @"Marc"; | |
} | |
@end | |
@implementation PrimefactorsTests | |
- (void)testPrimeFactorsOfOneAreEmptyList | |
{ | |
PrimeFactors *primeFactors = [[PrimeFactors alloc] init]; | |
NSArray *emptyArray = [[NSArray alloc] init]; | |
STAssertEquals([primeFactors factorsOf: 1], emptyArray, @"prime factors of one"); | |
STAssertEquals(@"Marc", [NSString myName], nil); | |
[emptyArray release]; | |
[primeFactors release]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment