Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions TestAssessment/TestViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,49 @@ @implementation TestViewController
This method should return any positive NSInteger
(hint: cannot be 0)
*/
- (void)shouldReturnAPositiveNSInteger {
- (NSInteger)shouldReturnAPositiveNSInteger {

return 10;

}

/*
This method should return any negative CGFloat
(hint: cannot be 0)
*/
- (void)shouldReturnANegativeCGFloat {
- (CGFloat)shouldReturnANegativeCGFloat {

return -15.5;
}

/*
This method should return a falsy boolean
Falsey: Something which evaluates to FALSE.
*/
- (void)shouldReturnAFalseyBool {
- (BOOL)shouldReturnAFalseyBool {

return FALSE;
}

/*
This method should return a single char from a - z
*/
- (void)shouldReturnACharAtoZ {
- (char)shouldReturnACharAtoZ {

return 'b';
}

/*
This method should return the sum of all numbers from
0 - 99 using a loop (. 1 + 2 + 3 + ... + 98 + 99)
*/
- (NSInteger)shouldReturnSumOf0To100 {

int sum = 0;
for (int i = 1; i <= 99; i++) {
sum = sum +i;
NSLog(@"%i", sum);
}
return 0;
}

Expand All @@ -57,6 +69,10 @@ Given a c array (int[]) and a count, return the sum of the numbers within the ar
(eg. arr[0] + arr[1] ...)
*/
- (NSInteger)shouldReturnSumOfArrayValues:(int *)arr withSize:(int)count {


arr[

return 0;
}

Expand All @@ -67,6 +83,8 @@ Provided a C string (array of chars), return the character
(hint: while loop)
*/
- (char)shouldReturnCharBeforeQ:(char *)str {


return '\0';
}

Expand All @@ -89,6 +107,13 @@ - (BOOL)isOdd:(NSInteger)aNumber {
This method should return YES if aNumber is a multiple of 5
*/
- (BOOL)isMultipleOfFive:(NSInteger)aNumber {
aNumber = 0;
for (int i = 1; i < 5; i++) {
aNumber = aNumber + i;
if (aNumber == 5) {
return YES;
}
}
return NO;
}

Expand All @@ -97,6 +122,12 @@ - (BOOL)isMultipleOfFive:(NSInteger)aNumber {
*/
- (BOOL)returnYesIfThisNumberIsOdd:(NSInteger)aNumber
andThisNumberIsEven:(NSInteger)bNumber {
aNumber = 7;
bNumber = 14;
if ( aNumber & 1) {
Ns
return YES;
} if
return NO;
}

Expand All @@ -105,7 +136,7 @@ - (BOOL)returnYesIfThisNumberIsOdd:(NSInteger)aNumber
parameter (hint: command + click on class name to jump to the interface.
*/
- (NSString *)shouldReturnPersonsName:(Person *)person {
return @"";
return @"person";
}

/*
Expand Down Expand Up @@ -149,6 +180,12 @@ - (void)makePersonStandUp:(Person *)person {
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/
*/
- (NSArray *)createAndReturnNSArray {

NSArray *stuff;

stuff = [NSArray arrayWithObjects: @"Something", @"Another", @"Lincoln", @"Carl", @"Rick", @"Doughlyn", nil];


return [[NSArray alloc] init];
}

Expand Down