Fix unit test warnings.

This commit is contained in:
Alexander Ljungberg committed 2013-01-24 00:08:47 +00:00
1 parent 65fd33b9cf
commit 6281c6469b
18 files changed
+81 -70

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
@import <AppKit/CGContext.j>
@import "CGTestCase.j"
@implementation CGContextTest : CGTestCase
+1 -1
View File
@@ -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.
+5 -5
View File
@@ -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];
@@ -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];
}
+1 -1
View File
@@ -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"];
+14 -14
View File
@@ -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]];
+1 -1
View File
@@ -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"];
}
+2 -2
View File
@@ -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
@end
+1 -1
View File
@@ -20,7 +20,7 @@
@implementation CPTabViewTest : OJTestCase
{
CPTabView _tableView;
CPTabView _tabView;
CPTabViewItem _tabItem1;
CPTabViewItem _tabItem2;
}
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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]];
}
+30 -27
View File
@@ -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"];
+1 -1
View File
@@ -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)
+5 -4
View File
@@ -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
+4 -2
View File
@@ -1,4 +1,5 @@
@import <Foundation/CPFormatter.j>
@import <Foundation/CPRange.j>
@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
@end
+3 -4
View File
@@ -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];
+1
View File
@@ -10,6 +10,7 @@
id bob;
id obj;
id obj2;
id cs101;
id focus;
+5 -1
View File
@@ -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