diff --git a/Tests/AppKit/CGContextTest.j b/Tests/AppKit/CGContextTest.j index e7f9e4b92..40288a0dd 100644 --- a/Tests/AppKit/CGContextTest.j +++ b/Tests/AppKit/CGContextTest.j @@ -1,4 +1,5 @@ @import + @import "CGTestCase.j" @implementation CGContextTest : CGTestCase diff --git a/Tests/AppKit/CPArrayControllerTest.j b/Tests/AppKit/CPArrayControllerTest.j index b63039b7e..83687650f 100644 --- a/Tests/AppKit/CPArrayControllerTest.j +++ b/Tests/AppKit/CPArrayControllerTest.j @@ -52,7 +52,7 @@ - (void)testSetContent { - otherContent = [@"5", @"6"]; + var otherContent = [@"5", @"6"]; [[self arrayController] setContent:otherContent]; // This has not been decided on yet. See Issue #795. diff --git a/Tests/AppKit/CPCheckBoxTest.j b/Tests/AppKit/CPCheckBoxTest.j index d2b388dbe..076850943 100644 --- a/Tests/AppKit/CPCheckBoxTest.j +++ b/Tests/AppKit/CPCheckBoxTest.j @@ -14,11 +14,11 @@ var control = [[CPCheckBox alloc] initWithFrame:CGRectMakeZero()]; [control setAllowsMixedState:YES]; - content = [ - CPOffState, - CPOnState - ]; - arrayController = [[CPArrayController alloc] initWithContent:content]; + var content = [ + CPOffState, + CPOnState + ], + arrayController = [[CPArrayController alloc] initWithContent:content]; // First test defaults. [control bind:CPValueBinding toObject:arrayController withKeyPath:@"selection.self" options:nil]; diff --git a/Tests/AppKit/CPKeyValueBindingSimpleBindingsTest.j b/Tests/AppKit/CPKeyValueBindingSimpleBindingsTest.j index 41c28b579..7475e0875 100644 --- a/Tests/AppKit/CPKeyValueBindingSimpleBindingsTest.j +++ b/Tests/AppKit/CPKeyValueBindingSimpleBindingsTest.j @@ -124,8 +124,8 @@ [self verifyVolume:0 method:"bindings"]; // Test if CPNullPlaceholderBindingOption is correctly decoded - var bindingInfo = [textField infoForBinding:@"value"]; - var nullPlaceHolder = [[bindingInfo objectForKey:CPOptionsKey] objectForKey:CPNullPlaceholderBindingOption]; + var bindingInfo = [textField infoForBinding:@"value"], + nullPlaceHolder = [[bindingInfo objectForKey:CPOptionsKey] objectForKey:CPNullPlaceholderBindingOption]; [self assert:@"Nothing" equals:nullPlaceHolder]; } @@ -140,7 +140,7 @@ - (void)updateVolumeFrom:(id)sender { - newVolume = [sender floatValue]; + var newVolume = [sender floatValue]; [track setVolume:newVolume]; [self updateUserInterface]; } diff --git a/Tests/AppKit/CPOutlineViewTest.j b/Tests/AppKit/CPOutlineViewTest.j index 7cebdee09..1c6dae2ae 100644 --- a/Tests/AppKit/CPOutlineViewTest.j +++ b/Tests/AppKit/CPOutlineViewTest.j @@ -130,7 +130,7 @@ [outlineView expandItem:".1.2"]; - afterSelection = [outlineView selectedRowIndexes]; + var afterSelection = [outlineView selectedRowIndexes]; [self assert:2 equals:[afterSelection count] message:"selections should remain"]; [self assert:".1.1" equals:[outlineView itemAtRow:[afterSelection firstIndex]] message:".1.1 selection should remain"]; diff --git a/Tests/AppKit/CPResponderTest.j b/Tests/AppKit/CPResponderTest.j index 1933aaaaa..6ce54098a 100644 --- a/Tests/AppKit/CPResponderTest.j +++ b/Tests/AppKit/CPResponderTest.j @@ -21,18 +21,18 @@ - (void)testInterpretKeyEvents { var tests = [ - CPKeyCodes.PAGE_UP, CPPageUpFunctionKey, @selector(scrollPageUp:), - CPKeyCodes.PAGE_DOWN, CPPageDownFunctionKey, @selector(scrollPageDown:), - CPKeyCodes.LEFT, CPLeftArrowFunctionKey, @selector(moveLeft:), - CPKeyCodes.RIGHT, CPRightArrowFunctionKey, @selector(moveRight:), - CPKeyCodes.UP, CPUpArrowFunctionKey, @selector(moveUp:), - CPKeyCodes.DOWN, CPDownArrowFunctionKey, @selector(moveDown:), - CPKeyCodes.BACKSPACE, CPDeleteCharacter, @selector(deleteBackward:), - CPKeyCodes.ENTER, CPCarriageReturnCharacter, @selector(insertNewline:), - 0, CPNewlineCharacter, @selector(insertNewline:), - CPKeyCodes.ESC, CPEscapeFunctionKey, @selector(cancelOperation:), - CPKeyCodes.TAB, CPTabCharacter, @selector(insertTab:) - ]; + CPKeyCodes.PAGE_UP, CPPageUpFunctionKey, @selector(scrollPageUp:), + CPKeyCodes.PAGE_DOWN, CPPageDownFunctionKey, @selector(scrollPageDown:), + CPKeyCodes.LEFT, CPLeftArrowFunctionKey, @selector(moveLeft:), + CPKeyCodes.RIGHT, CPRightArrowFunctionKey, @selector(moveRight:), + CPKeyCodes.UP, CPUpArrowFunctionKey, @selector(moveUp:), + CPKeyCodes.DOWN, CPDownArrowFunctionKey, @selector(moveDown:), + CPKeyCodes.BACKSPACE, CPDeleteCharacter, @selector(deleteBackward:), + CPKeyCodes.ENTER, CPCarriageReturnCharacter, @selector(insertNewline:), + 0, CPNewlineCharacter, @selector(insertNewline:), + CPKeyCodes.ESC, CPEscapeFunctionKey, @selector(cancelOperation:), + CPKeyCodes.TAB, CPTabCharacter, @selector(insertTab:) + ]; for (var i = 0; i < tests.length; i += 3) { @@ -41,7 +41,7 @@ selector = tests[i + 2]; responder.doCommandCalls = []; - keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:0 + var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:character charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode]; [responder interpretKeyEvents:[keyEvent]]; @@ -52,7 +52,7 @@ - (void)testInterpretKeyEventsWithModifierFlags { responder.doCommandCalls = []; - keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask + var keyEvent = [CPEvent keyEventWithType:CPKeyDown location:CGPointMakeZero() modifierFlags:CPShiftKeyMask timestamp:0 windowNumber:0 context:nil characters:CPLeftArrowFunctionKey charactersIgnoringModifiers:CPLeftArrowFunctionKey isARepeat:NO keyCode:CPKeyCodes.LEFT]; [responder interpretKeyEvents:[keyEvent]]; diff --git a/Tests/AppKit/CPSearchFieldTest.j b/Tests/AppKit/CPSearchFieldTest.j index 28f45a61c..3bd6029a8 100644 --- a/Tests/AppKit/CPSearchFieldTest.j +++ b/Tests/AppKit/CPSearchFieldTest.j @@ -22,7 +22,7 @@ - (void)testSetRecentSearches { - searches = ["foo", "bar", "baz"]; + var searches = ["foo", "bar", "baz"]; [_searchField setRecentSearches:searches] [self assertTrue:[[_searchField recentSearches] count] == 3 message:@"After setRecentSearches array doesn't include results"]; } diff --git a/Tests/AppKit/CPSliderTest.j b/Tests/AppKit/CPSliderTest.j index a2348aaea..9f74ffdad 100644 --- a/Tests/AppKit/CPSliderTest.j +++ b/Tests/AppKit/CPSliderTest.j @@ -23,7 +23,7 @@ var slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()]; [slider setContinuous:NO]; - decoded = [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slider]]; + var decoded = [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slider]]; [self assert:[slider isContinuous] equals:[decoded isContinuous] message:@"a decoded slider should preserve isContinuous (NO case)"]; [slider setContinuous:YES]; @@ -31,4 +31,4 @@ [self assert:[slider isContinuous] equals:[decoded isContinuous] message:@"a decoded slider should preserve isContinuous (YES case)"]; } -@end \ No newline at end of file +@end diff --git a/Tests/AppKit/CPTabViewTest.j b/Tests/AppKit/CPTabViewTest.j index fdde18b7e..6d668742d 100644 --- a/Tests/AppKit/CPTabViewTest.j +++ b/Tests/AppKit/CPTabViewTest.j @@ -20,7 +20,7 @@ @implementation CPTabViewTest : OJTestCase { - CPTabView _tableView; + CPTabView _tabView; CPTabViewItem _tabItem1; CPTabViewItem _tabItem2; } diff --git a/Tests/Foundation/CPArrayTest.j b/Tests/Foundation/CPArrayTest.j index 107b33fb0..3f308734b 100644 --- a/Tests/Foundation/CPArrayTest.j +++ b/Tests/Foundation/CPArrayTest.j @@ -616,7 +616,7 @@ [self assert:input1[1] equals:[output valueForKey:"1"] message:@"output[0]"]; [self assert:input1[2] equals:[output valueForKey:"2"] message:@"output[0]"]; - stoppingFunction = function(anObject, idx, stop) + var stoppingFunction = function(anObject, idx, stop) { [output setValue:anObject forKey:"" + idx]; if ([output count] > 1) diff --git a/Tests/Foundation/CPDateTest.j b/Tests/Foundation/CPDateTest.j index d719eee85..996d05787 100644 --- a/Tests/Foundation/CPDateTest.j +++ b/Tests/Foundation/CPDateTest.j @@ -5,8 +5,8 @@ - (void)testSince1970 { /* These two dates should be equal to Fri Jan 13 2009 23:31:30 +0000 */ - unixDate = [CPDate dateWithTimeIntervalSince1970:1231889490]; - cocoaDate = [CPDate dateWithTimeIntervalSinceReferenceDate:253582290]; + var unixDate = [CPDate dateWithTimeIntervalSince1970:1231889490], + cocoaDate = [CPDate dateWithTimeIntervalSinceReferenceDate:253582290]; [self assertTrue:[unixDate isEqualToDate:cocoaDate] message:[unixDate description] + " isEqualToDate: " + [cocoaDate description]]; } diff --git a/Tests/Foundation/CPDecimalTest.j b/Tests/Foundation/CPDecimalTest.j index 1a8411a09..4a0166038 100644 --- a/Tests/Foundation/CPDecimalTest.j +++ b/Tests/Foundation/CPDecimalTest.j @@ -34,7 +34,7 @@ var dcm = CPDecimalMakeWithString(@"11111111111111111111111111111111111111111"); [self assertNotNull:dcm message:"CPDecimalMakeWithString() Tb1: mantissa rounding string"]; [self assert:3 equals:dcm._exponent message:"CPDecimalMakeWithString() Tb1: exponent"]; - [self assert:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] equals:dcm._mantissa message:"CPDecimalMakeWithString() Tb1: mantissa"]; + [self assert:[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] equals:dcm._mantissa message:"CPDecimalMakeWithString() Tb1: mantissa"]; [self assert:NO equals:dcm._isNegative message:"CPDecimalMakeWithString() Tb1: sign"]; [self assert:NO equals:dcm._isNaN message:"CPDecimalMakeWithString() Tb1: NaN is incorrectly set"]; @@ -56,7 +56,7 @@ dcm = CPDecimalMakeWithString(@"-1234.5678e100"); [self assertNotNull:dcm message:"CPDecimalMakeWithString() Tf3: mantissa rounding string"]; [self assert:96 equals:dcm._exponent message:"CPDecimalMakeWithString() Tf3: exponent"]; - [self assert:[1,2,3,4,5,6,7,8] equals:dcm._mantissa message:"CPDecimalMakeWithString() Tf3: mantissa"]; + [self assert:[1, 2, 3, 4, 5, 6, 7, 8] equals:dcm._mantissa message:"CPDecimalMakeWithString() Tf3: mantissa"]; [self assert:YES equals:dcm._isNegative message:"CPDecimalMakeWithString() Tf3: sign"]; [self assert:NO equals:dcm._isNaN message:"CPDecimalMakeWithString() Tf3: NaN is incorrectly set"]; @@ -101,20 +101,20 @@ [self assertTrue:dcm._isNaN message:"CPDecimalMakeWithString() Ti10: catch of invalid number string. Should return NaN"]; //test make with parts - dcm = CPDecimalMakeWithParts(10127658,2); + dcm = CPDecimalMakeWithParts(10127658, 2); [self assert:2 equals:dcm._exponent message:"CPDecimalMakeWithParts() Tmp1: exponent"]; - [self assert:[1,0,1,2,7,6,5,8] equals:dcm._mantissa message:"CPDecimalMakeWithParts() Tmp1: mantissa"]; + [self assert:[1, 0, 1, 2, 7, 6, 5, 8] equals:dcm._mantissa message:"CPDecimalMakeWithParts() Tmp1: mantissa"]; [self assert:NO equals:dcm._isNegative message:"CPDecimalMakeWithParts() Tmp1: sign"]; [self assert:NO equals:dcm._isNaN message:"CPDecimalMakeWithParts() Tmp1: NaN is incorrectly set"]; - dcm = CPDecimalMakeWithParts(-1000000,0); + dcm = CPDecimalMakeWithParts(-1000000, 0); [self assert:6 equals:dcm._exponent message:"CPDecimalMakeWithParts() Tmp2: exponent"]; [self assert:[1] equals:dcm._mantissa message:"CPDecimalMakeWithParts() Tmp2: mantissa"]; [self assert:YES equals:dcm._isNegative message:"CPDecimalMakeWithParts() Tmp2: sign"]; [self assert:NO equals:dcm._isNaN message:"CPDecimalMakeWithParts() Tmp2: NaN is incorrectly set"]; - dcm = CPDecimalMakeWithParts(1,10000); + dcm = CPDecimalMakeWithParts(1, 10000); [self assertTrue:dcm._isNaN message:"CPDecimalMakeWithParts() Tmp3: exponent overflow not caught. Should return NaN"]; - dcm = CPDecimalMakeWithParts(-1,-1000); + dcm = CPDecimalMakeWithParts(-1, -1000); [self assertTrue:dcm._isNaN message:"CPDecimalMakeWithParts() Tmp4: exponent underflow not caught. Should return NaN"]; } @@ -143,6 +143,9 @@ - (void)testNormalize { + var dcm1, + dcm2; + dcm1 = CPDecimalMakeWithString( @"200" ); dcm2 = CPDecimalMakeWithString( @"2" ); [self assert:0 equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tn1:call" ]; @@ -172,7 +175,7 @@ [self assert:0 equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tn4:call" ]; [self assert:[1,0] equals:dcm1._mantissa message:"CPDecimalNormalise() Tn4: mantissa"]; [self assert:-8 equals:dcm1._exponent message:"CPDecimalNormalise() Tn4: exponent"]; - [self assert:[2,1] equals:dcm2._mantissa message:"CPDecimalNormalise() Tn4: mantissa"]; + [self assert:[2, 1] equals:dcm2._mantissa message:"CPDecimalNormalise() Tn4: mantissa"]; [self assert:-8 equals:dcm2._exponent message:"CPDecimalNormalise() Tn4: exponent"]; // these will result in one number becoming zero. @@ -181,13 +184,13 @@ [self assert:CPCalculationLossOfPrecision equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tnp1:call should ret LossOfPrecision" ]; [self assert:[0] equals:dcm1._mantissa message:"CPDecimalNormalise() Tnp1: mantissa"]; [self assert:0 equals:dcm1._exponent message:"CPDecimalNormalise() Tnp1: exponent"]; - [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] equals:dcm2._mantissa message:"CPDecimalNormalise() Tnp1: mantissa"]; + [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1] equals:dcm2._mantissa message:"CPDecimalNormalise() Tnp1: mantissa"]; [self assert:2 equals:dcm2._exponent message:"CPDecimalNormalise() Tnp1: exponent"]; dcm1 = CPDecimalMakeWithString( @"10000000000000000000000000000000000001e2" ); dcm2 = CPDecimalMakeWithString( @"1e0" ); [self assert:CPCalculationLossOfPrecision equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tnp2:call should ret LossOfPrecision" ]; - [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] equals:dcm1._mantissa message:"CPDecimalNormalise() Tnp2: mantissa"]; + [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1] equals:dcm1._mantissa message:"CPDecimalNormalise() Tnp2: mantissa"]; [self assert:2 equals:dcm1._exponent message:"CPDecimalNormalise() Tnp2:exponent"]; [self assert:[0] equals:dcm2._mantissa message:"CPDecimalNormalise() Tnp2: mantissa"]; [self assert:0 equals:dcm2._exponent message:"CPDecimalNormalise() Tnp2: exponent"]; @@ -195,7 +198,7 @@ dcm1 = CPDecimalMakeWithString( @"10000000000000000000000000000000000001e127" ); dcm2 = CPDecimalMakeWithString( @"1e0" ); [self assert:CPCalculationLossOfPrecision equals:CPDecimalNormalize(dcm1,dcm2,CPRoundDown) message:"CPDecimalNormalise() Tnp3:call should ret LossOfPrecision" ]; - [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] equals:dcm1._mantissa message:"CPDecimalNormalise() Tnp3: mantissa"]; + [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1] equals:dcm1._mantissa message:"CPDecimalNormalise() Tnp3: mantissa"]; [self assert:127 equals:dcm1._exponent message:"CPDecimalNormalise() Tnp3: exponent"]; [self assert:[0] equals:dcm2._mantissa message:"CPDecimalNormalise() Tnp3: mantissa"]; [self assert:0 equals:dcm2._exponent message:"CPDecimalNormalise() Tnp3: exponent"]; @@ -350,14 +353,14 @@ - (void)testCompact { var dcm = CPDecimalMakeZero(); - dcm._mantissa = [0,0,0,0,1,0,0,0,0,1]; + dcm._mantissa = [0,0,0,0, 1,0,0,0,0, 1]; dcm._exponent = 2; CPDecimalCompact(dcm); [self assert:2 equals:dcm._exponent message:"CPDecimalCompact() Tcm1: exponent"]; - [self assert:[1,0,0,0,0,1] equals:dcm._mantissa message:"CPDecimalCompact() Tcm1: mantissa"]; + [self assert:[1,0,0,0,0, 1] equals:dcm._mantissa message:"CPDecimalCompact() Tcm1: mantissa"]; dcm = CPDecimalMakeZero(); - dcm._mantissa = [0,0,0,0,1,2,0,0,0,0]; + dcm._mantissa = [0,0,0,0, 1,2,0,0,0,0]; dcm._exponent = -4; dcm._isNegative = YES; CPDecimalCompact(dcm); @@ -375,12 +378,12 @@ [self assert:NO equals:dcm._isNaN message:"CPDecimalCompact() Tcm3: NaN is incorrectly set"]; dcm = CPDecimalMakeZero(); - dcm._mantissa = [8,9,0,0,0,0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; + dcm._mantissa = [8,9,0,0,0,0, 1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; dcm._exponent = -20; dcm._isNegative = YES; CPDecimalCompact(dcm); [self assert:-5 equals:dcm._exponent message:"CPDecimalCompact() Tcm4: exponent"]; - [self assert:[8,9,0,0,0,0,1,2,3] equals:dcm._mantissa message:"CPDecimalCompact() Tcm4: mantissa"]; + [self assert:[8,9,0,0,0,0, 1,2,3] equals:dcm._mantissa message:"CPDecimalCompact() Tcm4: mantissa"]; [self assert:YES equals:dcm._isNegative message:"CPDecimalCompact() Tcm4: sign"]; [self assert:NO equals:dcm._isNaN message:"CPDecimalCompact() Tcm4: NaN is incorrectly set"]; } @@ -395,7 +398,7 @@ while (i--) [self assert:CPDecimalAdd(d1, d1, d2, CPRoundPlain) equals:CPCalculationNoError message:"CPDecimalAdd() Tap1: addition"]; [self assert:0 equals:d1._exponent message:"CPDecimalAdd() Tap1: exponent"]; - [self assert:[5,1] equals:d1._mantissa message:"CPDecimalAdd() Tap1: mantissa"]; + [self assert:[5, 1] equals:d1._mantissa message:"CPDecimalAdd() Tap1: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalAdd() Tap1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalAdd() Tap1: NaN is incorrectly set"]; @@ -404,7 +407,7 @@ d2 = CPDecimalMakeWithString(@"-1e-10"); [self assert:CPCalculationNoError equals:CPDecimalAdd(d1, d1, d2, CPRoundPlain) message:"CPDecimalAdd() Tan1: addition of 2 negatives"]; [self assert:-10 equals:d1._exponent message:"CPDecimalAdd() Tan1: exponent"]; - [self assert:[1,0,0,0,0,0,0,0,0,0,1] equals:d1._mantissa message:"CPDecimalAdd() Tan1: mantissa"]; + [self assert:[1,0,0,0,0,0,0,0,0,0, 1] equals:d1._mantissa message:"CPDecimalAdd() Tan1: mantissa"]; [self assert:YES equals:d1._isNegative message:"CPDecimalAdd() Tan1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalAdd() Tan1: NaN is incorrectly set"]; @@ -429,7 +432,7 @@ d2 = CPDecimalMakeWithString(@"99999999999999999999999999999999999999"); [self assert:0 equals:CPDecimalAdd(d1, d1, d2, CPRoundPlain) message:"CPDecimalAdd() Tapc1: addition with mantissa overflow and rounding"]; [self assert:1 equals:d1._exponent message:"CPDecimalAdd() Tapc1: exponent"]; - [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4] equals:d1._mantissa message:"CPDecimalAdd() Tapc1: mantissa"]; + [self assert:[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,3,4] equals:d1._mantissa message:"CPDecimalAdd() Tapc1: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalAdd() Tapc1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalAdd() Tapc1: NaN is incorrectly set"]; @@ -450,7 +453,7 @@ d3 = CPDecimalMakeWithString(@"12.67"); [self assert:CPCalculationNoError equals:CPDecimalSubtract(d1,d2,d3,CPRoundPlain) message:"CPDecimalSubtract(): Ts1: Should succeed"]; [self assert:-3 equals:d1._exponent message:"CPDecimalSubtract(): Ts1: exponent"]; - [self assert:[1,1,7,9,5] equals:d1._mantissa message:"CPDecimalSubtract(): Ts1: mantissa"]; + [self assert:[1, 1,7,9,5] equals:d1._mantissa message:"CPDecimalSubtract(): Ts1: mantissa"]; [self assert:YES equals:d1._isNegative message:"CPDecimalSubtract(): Ts1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalSubtract(): Ts1: NaN is incorrectly set"]; @@ -459,7 +462,7 @@ d3 = CPDecimalMakeWithString(@"-12.67"); [self assert:CPCalculationNoError equals:CPDecimalSubtract(d1,d2,d3,CPRoundPlain) message:"CPDecimalSubtract(): Ts2: Should succeed"]; [self assert:-3 equals:d1._exponent message:"CPDecimalSubtract(): Ts2: exponent"]; - [self assert:[1,1,7,9,5] equals:d1._mantissa message:"CPDecimalSubtract(): Ts2: mantissa"]; + [self assert:[1, 1,7,9,5] equals:d1._mantissa message:"CPDecimalSubtract(): Ts2: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalSubtract(): Ts2: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalSubtract(): Ts2: NaN is incorrectly set"]; @@ -499,7 +502,7 @@ d3 = CPDecimalMakeWithString(@"-5e20"); [self assert:CPCalculationNoError equals:CPDecimalDivide(d1,d2,d3,CPRoundPlain) message:"CPDecimalDivide(): Td1: Should succeed"]; [self assert:-8 equals:d1._exponent message:"CPDecimalDivide(): Td1: exponent"]; - [self assert:[1,1] equals:d1._mantissa message:"CPDecimalDivide(): Td1: mantissa"]; + [self assert:[1, 1] equals:d1._mantissa message:"CPDecimalDivide(): Td1: mantissa"]; [self assert:YES equals:d1._isNegative message:"CPDecimalDivide(): Td1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalDivide(): Td1: NaN is incorrectly set"]; @@ -536,7 +539,7 @@ d3 = CPDecimalMakeWithString(@"12"); [self assert:CPCalculationLossOfPrecision equals:CPDecimalDivide(d1,d2,d3,CPRoundUp) message:"CPDecimalDivide(): Tdp2: Should Loss of precision"]; [self assert:-39 equals:d1._exponent message:"CPDecimalDivide(): Td2: exponent"]; - [self assert:[7,2,9,1,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6] equals:d1._mantissa message:"CPDecimalDivide(): Td2: mantissa"]; + [self assert:[7,2,9, 1,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6] equals:d1._mantissa message:"CPDecimalDivide(): Td2: mantissa"]; [self assert:YES equals:d1._isNegative message:"CPDecimalDivide(): Td2: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalDivide(): Td2: NaN is incorrectly set"]; @@ -564,7 +567,7 @@ d3 = CPDecimalMakeWithString(@"-1441231251321235231"); [self assert:CPCalculationNoError equals:CPDecimalMultiply(d1,d2,d3,CPRoundPlain) message:"CPDecimalMultiply(): Tm1: Should succeed"]; [self assert:0 equals:d1._exponent message:"CPDecimalMultiply(): Tm1: exponent"]; - [self assert:[1,7,2,9,4,7,7,5,0,1,5,8,5,4,8,2,2,7,7,2] equals:d1._mantissa message:"CPDecimalMultiply(): Tm1: mantissa"]; + [self assert:[1,7,2,9,4,7,7,5,0, 1,5,8,5,4,8,2,2,7,7,2] equals:d1._mantissa message:"CPDecimalMultiply(): Tm1: mantissa"]; [self assert:YES equals:d1._isNegative message:"CPDecimalMultiply(): Tm1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalMultiply(): Tm1: NaN is incorrectly set"]; @@ -601,7 +604,7 @@ d3 = CPDecimalMakeWithString(@"127889465810478913"); [self assert:CPCalculationLossOfPrecision equals:CPDecimalMultiply(d1,d2,d3,CPRoundDown) message:"CPDecimalMultiply(): Tmp1: Should throw loss of precision"]; [self assert:15 equals:d1._exponent message:"CPDecimalMultiply(): Tmp1: exponent"]; // 69 diff - [self assert:[2,7,1,5,6,2,0,9,1,7,5,7,6,3,3,5,0,9,2,9,7,4,0,2,3,5,6,0,8,0,6,9,5,2,8,3,9,1] equals:d1._mantissa message:"CPDecimalMultiply(): Tmp1: mantissa"]; + [self assert:[2,7, 1,5,6,2,0,9, 1,7,5,7,6,3,3,5,0,9,2,9,7,4,0,2,3,5,6,0,8,0,6,9,5,2,8,3,9, 1] equals:d1._mantissa message:"CPDecimalMultiply(): Tmp1: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalMultiply(): Tmp1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalMultiply(): Tmp1: NaN is incorrectly set"]; @@ -621,7 +624,7 @@ d3 = 12; [self assert:CPCalculationNoError equals:CPDecimalPower(d1,d2,d3,CPRoundPlain) message:"CPDecimalPower(): Tp1: Should succeed"]; [self assert:0 equals:d1._exponent message:"CPDecimalPower(): Tp1: exponent"]; - [self assert:[1,1,9,9,1,1,6,3,8,4,8,7,1,6,9,0,6,2,9,7,0,7,2,7,2,1] equals:d1._mantissa message:"CPDecimalPower(): Tp1: mantissa"]; + [self assert:[1, 1,9,9, 1, 1,6,3,8,4,8,7, 1,6,9,0,6,2,9,7,0,7,2,7,2, 1] equals:d1._mantissa message:"CPDecimalPower(): Tp1: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalPower(): Tp1: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalPower(): Tp1: NaN is incorrectly set"]; @@ -632,7 +635,7 @@ d3 = 101; [self assert:CPCalculationLossOfPrecision equals:CPDecimalPower(d1,d2,d3,CPRoundUp) message:"CPDecimalPower(): Tp2: Should throw Loss of precision"]; [self assert:-43 equals:d1._exponent message:"CPDecimalPower(): Tp2: exponent"]; - [self assert:[1,3,8,9,3,5,5,4,0,5,9,9,2,5,6,6,1,2,7,4,8,2,1,8,1,4,6,3,6,8,0,7,5,3,5,2,0,4] equals:d1._mantissa message:"CPDecimalPower(): Tp2: mantissa"]; + [self assert:[1,3,8,9,3,5,5,4,0,5,9,9,2,5,6,6, 1,2,7,4,8,2, 1,8, 1,4,6,3,6,8,0,7,5,3,5,2,0,4] equals:d1._mantissa message:"CPDecimalPower(): Tp2: mantissa"]; [self assert:NO equals:d1._isNegative message:"CPDecimalPower(): Tp2: sign"]; [self assert:NO equals:d1._isNaN message:"CPDecimalPower(): Tp2: NaN is incorrectly set"]; diff --git a/Tests/Foundation/CPDictionaryTest.j b/Tests/Foundation/CPDictionaryTest.j index cd7e43c1f..7389ca05b 100644 --- a/Tests/Foundation/CPDictionaryTest.j +++ b/Tests/Foundation/CPDictionaryTest.j @@ -367,7 +367,7 @@ // Stop enumerating after two keys. output = [CPMutableDictionary dictionary]; - stoppingFunction = function(aKey, anObject, stop) + var stoppingFunction = function(aKey, anObject, stop) { [output setValue:anObject forKey:aKey]; if ([output count] > 1) diff --git a/Tests/Foundation/CPExceptionTest.j b/Tests/Foundation/CPExceptionTest.j index 6451e32b5..9c038223d 100644 --- a/Tests/Foundation/CPExceptionTest.j +++ b/Tests/Foundation/CPExceptionTest.j @@ -2,6 +2,7 @@ @implementation CPExceptionTest : OJTestCase { + CPException exception; } - (void)setUp @@ -13,9 +14,9 @@ - (void)testInitWithNameReasonUserInfo { - var exception = [[CPException alloc] initWithName:@"CPUnsupportedMethodException" - reason:@"setHeaderCell: is not supported. -setHeaderCell:aView instead." - userInfo:nil]; + exception = [[CPException alloc] initWithName:@"CPUnsupportedMethodException" + reason:@"setHeaderCell: is not supported. -setHeaderCell:aView instead." + userInfo:nil]; [self assert:[exception name] equals:"CPUnsupportedMethodException"]; [self assert:[exception reason] equals:"setHeaderCell: is not supported. -setHeaderCell:aView instead."]; [self assertThrows:function(){[exception raise]}]; @@ -43,7 +44,7 @@ - (void)testRaise { - [self assertThrows:function(){[exception raise];}]; + [self assertThrows:function() { [exception raise]; }]; } @end diff --git a/Tests/Foundation/CPFormatterTest.j b/Tests/Foundation/CPFormatterTest.j index 04a4afd7c..ff7218ece 100644 --- a/Tests/Foundation/CPFormatterTest.j +++ b/Tests/Foundation/CPFormatterTest.j @@ -1,4 +1,5 @@ @import +@import @implementation CPFormatterTest : OJTestCase @@ -39,6 +40,7 @@ { var formatter = [[CPFormatter alloc] init]; - [self assertThrows:function(){ [formatter isPartialStringValue:@"Hello Wolrd" proposedSelectedRange:CPRangeMake(3,5) originalString:@"Hello World" originalSelectedRange:nil errorDescription:nil]; }]; + [self assertThrows:function(){ [formatter isPartialStringValue:@"Hello Wolrd" proposedSelectedRange:CPMakeRange(3, 5) originalString:@"Hello World" originalSelectedRange:nil errorDescription:nil]; }]; } -@end \ No newline at end of file + +@end diff --git a/Tests/Foundation/CPFunctionOperationTest.j b/Tests/Foundation/CPFunctionOperationTest.j index cc4086440..a713abdea 100644 --- a/Tests/Foundation/CPFunctionOperationTest.j +++ b/Tests/Foundation/CPFunctionOperationTest.j @@ -17,11 +17,10 @@ - (void)testRunInvocation { - so = [[SomeObject alloc] init]; + var so = [[SomeObject alloc] init], + someVar = nil, - var someVar = nil; - - funcOp = [CPFunctionOperation functionOperationWithFunction:function() {[so setAString:@"Hello World"]}]; + funcOp = [CPFunctionOperation functionOperationWithFunction:function() { [so setAString:@"Hello World"] }]; [funcOp addExecutionFunction:function() {someVar = 'Soylent Green';}]; [funcOp start]; diff --git a/Tests/Foundation/CPKVOTest.j b/Tests/Foundation/CPKVOTest.j index f0cb0e25e..57ba2dd8c 100644 --- a/Tests/Foundation/CPKVOTest.j +++ b/Tests/Foundation/CPKVOTest.j @@ -10,6 +10,7 @@ id bob; id obj; + id obj2; id cs101; id focus; diff --git a/Tests/Foundation/CPKeyValueObservingTest.j b/Tests/Foundation/CPKeyValueObservingTest.j index 55c9f5f9d..82a0e4a7e 100644 --- a/Tests/Foundation/CPKeyValueObservingTest.j +++ b/Tests/Foundation/CPKeyValueObservingTest.j @@ -5,6 +5,10 @@ @implementation CPKeyValueObservingTest : OJTestCase { + CPString _lastKeyPath; + id _lastObject; + CPDictionary _lastChange; + id _lastContext; } - (Class)objectWithMethods:(CPString)aMethodName, ... @@ -24,7 +28,7 @@ - (void)setup { - _lastKeyPath = _lastObject = _lastChange = _lastContext = nil; + _lastKeyPath = _lastObject = _lastChange = _lastContext = nil; } - (void)testInitialObserving