Update of /cvsroot/macattrick/macattrick/Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5163/Test Modified Files: AllTests.h AllTests.m ArenaTest.h ArenaTest.m ClubTest.h ClubTest.m EconomyTest.h EconomyTest.m HattrickOrgTest.h HattrickOrgTest.m LeagueTest.h LeagueTest.m LineUpTreeLayerTest.h LineUpTreeLayerTest.m LineUpTreeNodeTest.h LineUpTreeNodeTest.m LineUpTreeTest.h LineUpTreeTest.m PlayerListTest.h PlayerListTest.m PlayerSortingTest.h PlayerSortingTest.m PlayerTest.h PlayerTest.m PositionHeapTest.h PositionHeapTest.m PositionTest.h PositionTest.m PropertiesTest.h PropertiesTest.m TeamTest.h TeamTest.m TrainingTest.h TrainingTest.m UserTest.h UserTest.m WorldTest.h WorldTest.m Log Message: Migration of tests from ObjcUnit to UnitKit, small bugs fixed Index: LeagueTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LeagueTest.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LeagueTest.m 3 Oct 2004 19:26:57 -0000 1.2 --- LeagueTest.m 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 37,51 **** NSString* urlString = [NSString stringWithFormat:@"%@/Test/leagueDetails.xml", [Properties libraryPath]]; League* leagueLocal = [[League alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! [self assertNotNil:leagueLocal message:@"league nil"]; ! [self assertString:[leagueLocal country] equals:@"Schweiz"]; ! [self assertString:[leagueLocal leagueName] equals:@"VI.279"]; ! [self assertInt:[leagueLocal leagueLevel] equals:6]; ! [self assertInt:[leagueLocal maxLevel] equals:8]; ! [self assertInt:[leagueLocal position] equals:1]; ! [self assertInt:[leagueLocal matches] equals:11]; ! [self assertInt:[leagueLocal goalsFor] equals:44]; ! [self assertInt:[leagueLocal goalsAgainst] equals:22]; ! [self assertInt:[leagueLocal points] equals:23]; ! [self assertInt:[leagueLocal leagueID] equals:46]; [pool release]; } --- 37,51 ---- NSString* urlString = [NSString stringWithFormat:@"%@/Test/leagueDetails.xml", [Properties libraryPath]]; League* leagueLocal = [[League alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! UKNotNil(leagueLocal ); ! UKStringsEqual([leagueLocal country] ,@"Schweiz"); ! UKStringsEqual([leagueLocal leagueName] ,@"VI.279"); ! UKIntsEqual([leagueLocal leagueLevel] ,6); ! UKIntsEqual([leagueLocal maxLevel] ,8); ! UKIntsEqual([leagueLocal position] ,1); ! UKIntsEqual([leagueLocal matches] ,11); ! UKIntsEqual([leagueLocal goalsFor] ,44); ! UKIntsEqual([leagueLocal goalsAgainst] ,22); ! UKIntsEqual([leagueLocal points] ,23); ! UKIntsEqual([leagueLocal leagueID] ,46); [pool release]; } *************** *** 53,60 **** -(void) testInit { League* league = [[League alloc] init]; ! [self assertNotNil:league message:@"league nil"]; ! [self assertNotNil:[league country] message:@"country nil"]; ! [self assertNotNil:[league leagueName] message:@"league name nil"]; ! [self assertTrue:[league leagueLevel] <= [league maxLevel]]; } --- 53,60 ---- -(void) testInit { League* league = [[League alloc] init]; ! UKNotNil(league ); ! UKNotNil([league country] ); ! UKNotNil([league leagueName] ); ! UKTrue([league leagueLevel] <= [league maxLevel]); } Index: LineUpTreeLayerTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeLayerTest.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LineUpTreeLayerTest.m 7 Feb 2005 21:16:28 -0000 1.5 --- LineUpTreeLayerTest.m 27 Apr 2005 19:36:45 -0000 1.6 *************** *** 33,36 **** --- 33,44 ---- + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void)setUp { player1 = [[Player alloc] init]; *************** *** 73,81 **** - (void) testRunProvidesResult { LineUpTreeLayer *layer1 = [rootLayer calculateNextLayer:position1]; ! [self assertInt: [[layer1 layerNodes] count] equals: 3]; LineUpTreeLayer *layer2 = [layer1 calculateNextLayer:position2]; ! [self assertInt: [[layer2 layerNodes] count] equals: 6]; LineUpTreeLayer *layer3 = [layer1 calculateNextLayer:position3]; ! [self assertInt: [[layer3 layerNodes] count] equals: 6]; } --- 81,89 ---- - (void) testRunProvidesResult { LineUpTreeLayer *layer1 = [rootLayer calculateNextLayer:position1]; ! UKIntsEqual( [[layer1 layerNodes] count] , 3); LineUpTreeLayer *layer2 = [layer1 calculateNextLayer:position2]; ! UKIntsEqual( [[layer2 layerNodes] count] , 6); LineUpTreeLayer *layer3 = [layer1 calculateNextLayer:position3]; ! UKIntsEqual( [[layer3 layerNodes] count] , 6); } *************** *** 83,102 **** - (void) testRunProvidesResultWithPruning { LineUpTreeLayer *layer1 = [rootLayer2 calculateNextLayer:position1]; ! [self assertTrue: [[layer1 layerNodes] count] > 0]; ! [self assertTrue: [[layer1 layerNodes] count] <= 3]; ! [self assertInt: [[layer1 layerNodes] count] equals: 1]; LineUpTreeLayer *layer2 = [layer1 calculateNextLayer:position2]; ! [self assertTrue: [[layer2 layerNodes] count] > 0]; ! [self assertTrue: [[layer2 layerNodes] count] <= 6]; ! [self assertInt: [[layer2 layerNodes] count] equals: 2]; LineUpTreeLayer *layer3 = [layer1 calculateNextLayer:position3]; ! [self assertTrue: [[layer3 layerNodes] count] > 0]; ! [self assertTrue: [[layer3 layerNodes] count] <= 6]; ! [self assertInt: [[layer3 layerNodes] count] equals: 2]; } - (void) testBestScoringNode { LineUpTreeLayer *finalLayer = [[[rootLayer calculateNextLayer:position1] calculateNextLayer:position2] calculateNextLayer:position3]; ! [self assertFloat:[[finalLayer bestScoringNode] score]equals:18.3 precision:0.01]; } @end --- 91,110 ---- - (void) testRunProvidesResultWithPruning { LineUpTreeLayer *layer1 = [rootLayer2 calculateNextLayer:position1]; ! UKTrue( [[layer1 layerNodes] count] > 0); ! UKTrue( [[layer1 layerNodes] count] <= 3); ! UKIntsEqual( [[layer1 layerNodes] count] , 1); LineUpTreeLayer *layer2 = [layer1 calculateNextLayer:position2]; ! UKTrue( [[layer2 layerNodes] count] > 0); ! UKTrue( [[layer2 layerNodes] count] <= 6); ! UKIntsEqual( [[layer2 layerNodes] count] , 2); LineUpTreeLayer *layer3 = [layer1 calculateNextLayer:position3]; ! UKTrue( [[layer3 layerNodes] count] > 0); ! UKTrue( [[layer3 layerNodes] count] <= 6); ! UKIntsEqual( [[layer3 layerNodes] count] , 2); } - (void) testBestScoringNode { LineUpTreeLayer *finalLayer = [[[rootLayer calculateNextLayer:position1] calculateNextLayer:position2] calculateNextLayer:position3]; ! UKFloatsEqual([[finalLayer bestScoringNode] score],18.3 ,0.01); } @end Index: LeagueTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LeagueTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LeagueTest.h 28 Sep 2004 17:59:04 -0000 1.1 --- LeagueTest.h 27 Apr 2005 19:36:45 -0000 1.2 *************** *** 28,35 **** #import <Cocoa/Cocoa.h> ! #import <ObjcUnit/ObjcUnit.h> ! @interface LeagueTest : TestCase { } --- 28,35 ---- #import <Cocoa/Cocoa.h> ! #import <UnitKit/UnitKit.h> ! @interface LeagueTest : NSObject <UKTest> { } Index: ArenaTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/ArenaTest.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArenaTest.m 21 Sep 2004 17:02:14 -0000 1.1 --- ArenaTest.m 27 Apr 2005 19:36:44 -0000 1.2 *************** *** 37,47 **** NSString* urlString = [NSString stringWithFormat:@"%@/Test/arenaDetails.xml", [Properties libraryPath]]; Arena* arenaLocal = [[Arena alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! [self assertNotNil:arenaLocal]; ! [self assertString:[arenaLocal name] equals:@"Arena Name"]; ! [self assertInt:[arenaLocal terraces] equals:15750]; ! [self assertInt:[arenaLocal basic] equals:6250]; ! [self assertInt:[arenaLocal roof] equals:2500]; ! [self assertInt:[arenaLocal vip] equals:500]; ! [self assertInt:[arenaLocal total] equals:25000]; [arenaLocal release]; [pool release]; --- 37,47 ---- NSString* urlString = [NSString stringWithFormat:@"%@/Test/arenaDetails.xml", [Properties libraryPath]]; Arena* arenaLocal = [[Arena alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! UKNotNil(arenaLocal); ! UKStringsEqual([arenaLocal name] ,@"Arena Name"); ! UKIntsEqual([arenaLocal terraces] ,15750); ! UKIntsEqual([arenaLocal basic] ,6250); ! UKIntsEqual([arenaLocal roof] ,2500); ! UKIntsEqual([arenaLocal vip] ,500); ! UKIntsEqual([arenaLocal total] ,25000); [arenaLocal release]; [pool release]; *************** *** 50,60 **** -(void) testDownload { Arena * arena = [[Arena alloc]init]; ! [self assertNotNil:arena message: @"is nil"]; ! [self assertNotNil:[arena name] message: @"name is nil"]; ! [self assertTrue:[arena terraces] > 0 message: @"terraces"]; ! [self assertTrue:[arena basic] >= 0 message: @"basic"]; ! [self assertTrue:[arena roof] >= 0 message: @"roof"]; ! [self assertTrue:[arena vip] >= 0 message: @"vip"]; ! [self assertInt:[arena total] equals:[arena terraces] +[arena basic]+[arena roof]+[arena vip] ]; [arena release]; } --- 50,60 ---- -(void) testDownload { Arena * arena = [[Arena alloc]init]; ! UKNotNil(arena ); ! UKNotNil([arena name] ); ! UKTrue([arena terraces] > 0 ); ! UKTrue([arena basic] >= 0 ); ! UKTrue([arena roof] >= 0 ); ! UKTrue([arena vip] >= 0 ); ! UKIntsEqual([arena total] ,[arena terraces] +[arena basic]+[arena roof]+[arena vip] ); [arena release]; } Index: LineUpTreeLayerTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeLayerTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LineUpTreeLayerTest.h 4 May 2004 10:38:04 -0000 1.1 --- LineUpTreeLayerTest.h 27 Apr 2005 19:36:45 -0000 1.2 *************** *** 27,36 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import <Foundation/Foundation.h> #import "LineUpTreeLayer.h" #import "LineUpTreeNode.h" ! @interface LineUpTreeLayerTest : TestCase { Player *player1; Player *player2; --- 27,36 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import <Foundation/Foundation.h> #import "LineUpTreeLayer.h" #import "LineUpTreeNode.h" ! @interface LineUpTreeLayerTest : NSObject <UKTest> { Player *player1; Player *player2; Index: PropertiesTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PropertiesTest.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PropertiesTest.m 11 Sep 2004 15:44:34 -0000 1.2 --- PropertiesTest.m 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 32,36 **** @implementation PropertiesTest -(void) testOnlineVersion { ! [self assertTrue: [Properties onlineVersion] >= 0.2]; } --- 32,36 ---- @implementation PropertiesTest -(void) testOnlineVersion { ! UKTrue( [Properties onlineVersion] >= 0.2); } Index: TeamTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/TeamTest.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TeamTest.m 3 Oct 2004 09:30:16 -0000 1.17 --- TeamTest.m 27 Apr 2005 19:36:45 -0000 1.18 *************** *** 31,34 **** --- 31,42 ---- @implementation TeamTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void)setUp { team = [[Team alloc] init]; *************** *** 36,70 **** - (void) testInit { ! [self assertNotNil:team message: @"team nil"]; ! [self assertNotNil:[team user] message: @"user nil"]; ! [self assertNotNil:[team economy] message: @"economy nil"]; ! [self assertNotNil:[team playerList] message: @"playerList nil"]; ! [self assertNotNil:[team arena] message: @"arena nil"]; ! [self assertNotNil:[team training] message: @"training nil"]; } -(void) testCurrentTeam { ! [self assert:[Team currentTeam] equals:team]; } -(void) testTeamID { ! [self assertTrue:[team teamID] > 0 message: @"team id <=0"]; } -(void) testTeamName { ! [self assertTrue:[[team teamName]length] > 0 message: @"team name lenght <=0"]; } -(void) testHomepage { ! [self assertTrue:[[[team homepage] absoluteString]length] > 0 message: @"team homepage lenght <=0"]; } -(void) testNumberOfVictories { ! [self assertTrue:[team numberOfVictories] >= 0 message: @"victories <=0"]; } -(void) testNumberOfUndefeated { ! [self assertTrue:[team numberOfUndefeated] >= 0 message: @"undefeated <=0"]; } --- 44,78 ---- - (void) testInit { ! UKNotNil(team ); ! UKNotNil([team user] ); ! UKNotNil([team economy] ); ! UKNotNil([team playerList] ); ! UKNotNil([team arena] ); ! UKNotNil([team training] ); } -(void) testCurrentTeam { ! UKObjectsEqual([Team currentTeam] ,team); } -(void) testTeamID { ! UKTrue([team teamID] > 0 ); } -(void) testTeamName { ! UKTrue([[team teamName]length] > 0 ); } -(void) testHomepage { ! UKTrue([[[team homepage] absoluteString]length] > 0 ); } -(void) testNumberOfVictories { ! UKTrue([team numberOfVictories] >= 0 ); } -(void) testNumberOfUndefeated { ! UKTrue([team numberOfUndefeated] >= 0 ); } Index: TrainingTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/TrainingTest.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TrainingTest.m 29 Sep 2004 18:42:33 -0000 1.3 --- TrainingTest.m 27 Apr 2005 19:36:45 -0000 1.4 *************** *** 38,46 **** NSString* urlString = [NSString stringWithFormat:@"%@/Test/training.xml", [Properties libraryPath]]; Training* trainingLocal = [[Training alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! [self assertNotNil:trainingLocal]; ! [self assertString:[trainingLocal trainingType] equals:NSLocalizedString(@"Defending", @"Defending")]; ! [self assertInt:[trainingLocal level] equals:100]; ! [self assertInt:[trainingLocal morale] equals:8]; ! [self assertInt:[trainingLocal selfConfidence] equals:5]; [trainingLocal release]; [pool release]; --- 38,46 ---- NSString* urlString = [NSString stringWithFormat:@"%@/Test/training.xml", [Properties libraryPath]]; Training* trainingLocal = [[Training alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! UKNotNil(trainingLocal); ! UKStringsEqual([trainingLocal trainingType] ,NSLocalizedString(@"Defending", @"Defending")); ! UKIntsEqual([trainingLocal level] ,100); ! UKIntsEqual([trainingLocal morale] ,8); ! UKIntsEqual([trainingLocal selfConfidence] ,5); [trainingLocal release]; [pool release]; *************** *** 49,55 **** -(void) testLoading { Training * training = [[Training alloc]init]; ! [self assertNotNil:training message: @"is nil"]; ! [self assertTrue:[training level] >= 0 message: @"training level negative"]; ! [self assertNotNil:[training trainingType] message: @"trainingType nil"]; [training release]; } --- 49,55 ---- -(void) testLoading { Training * training = [[Training alloc]init]; ! UKNotNil(training ); ! UKTrue([training level] >= 0 ); ! UKNotNil([training trainingType] ); [training release]; } *************** *** 57,61 **** -(void) testTrainerLoading { Team *team = [[Team alloc] init]; ! [self assertNotNil:[[team training] trainer] message: @"trainer nil"]; [team release]; } --- 57,61 ---- -(void) testTrainerLoading { Team *team = [[Team alloc] init]; ! UKNotNil([[team training] trainer] ); [team release]; } Index: UserTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/UserTest.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserTest.m 28 Nov 2004 14:07:06 -0000 1.2 --- UserTest.m 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 36,44 **** NSString* urlString = [NSString stringWithFormat:@"%@/Test/teamDetails.xml", [Properties libraryPath]]; User* user = [[User alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! [self assertString:[user loginname] equals:@"FelicioFalcio"]; ! [self assertString:[user name] equals:@"-"]; ! [self assertString:[user email] equals:@"-"]; ! [self assertString:[user icq] equals:@"-"]; ! [self assertTrue:[user isSupporter]]; [user release]; [pool release]; --- 36,44 ---- NSString* urlString = [NSString stringWithFormat:@"%@/Test/teamDetails.xml", [Properties libraryPath]]; User* user = [[User alloc] initFromXML:[NSURL fileURLWithPath:urlString]]; ! UKStringsEqual([user loginname] ,@"FelicioFalcio"); ! UKStringsEqual([user name] ,@"-"); ! UKStringsEqual([user email] ,@"-"); ! UKStringsEqual([user icq] ,@"-"); ! UKTrue([user isSupporter]); [user release]; [pool release]; *************** *** 48,54 **** -(void) testInit { User* user = [[User alloc] init]; ! [self assertNotNil:[user loginname] message:@"loginname"]; ! [self assertNotNil:[user name] message:@"name"]; ! [self assertNotNil:[user email] message:@"email"]; [user release]; } --- 48,54 ---- -(void) testInit { User* user = [[User alloc] init]; ! UKNotNil([user loginname] ); ! UKNotNil([user name] ); ! UKNotNil([user email] ); [user release]; } Index: TrainingTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/TrainingTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TrainingTest.h 26 Sep 2004 12:04:10 -0000 1.1 --- TrainingTest.h 27 Apr 2005 19:36:45 -0000 1.2 *************** *** 27,34 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import "Training.h" #import "Properties.h" ! @interface TrainingTest : TestCase { } --- 27,34 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import "Training.h" #import "Properties.h" ! @interface TrainingTest : NSObject <UKTest> { } Index: TeamTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/TeamTest.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TeamTest.h 19 Sep 2004 17:06:46 -0000 1.5 --- TeamTest.h 27 Apr 2005 19:36:45 -0000 1.6 *************** *** 27,31 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import "AllTests.h" #import "HattrickOrg.h" --- 27,31 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import "AllTests.h" #import "HattrickOrg.h" *************** *** 33,37 **** #import "Team.h" ! @interface TeamTest : TestCase { Team *team; } --- 33,37 ---- #import "Team.h" ! @interface TeamTest : NSObject <UKTest> { Team *team; } Index: PlayerTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerTest.m,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PlayerTest.m 7 Feb 2005 21:16:29 -0000 1.15 --- PlayerTest.m 27 Apr 2005 19:36:45 -0000 1.16 *************** *** 35,38 **** --- 35,46 ---- @implementation PlayerTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void)setUp { player1 = [[Player alloc] init]; *************** *** 49,119 **** - (void)testStamina { ! [self assertInt:[player1 staminaSkill] equals:3 message:@"stamina incorrect"]; } - (void)testCountryID { ! [self assertInt:[marcel countryID] equals:41]; ! [self assertInt:[walter countryID] equals:40]; } - (void)testCountryName { ! [self assertString:[walter countryName] equals:@"Schweiz"]; } -(void)testPlayerForm { ! [self assertInt:[player1 playerForm] equals:5]; } -(void)testLoadedPlayer { ! [self assert:[walter playerName] equals: @"Walter Gasparin"]; ! [self assertInt:[walter injuryLevel] equals: -1 ]; ! [self assertInt:[walter playerForm] equals: 5 ]; ! [self assertInt:[walter experience] equals: 4 ]; } -(void)testLoadedPlayerSkills { ! [self assertInt:[walter staminaSkill] equals: 7 ]; ! [self assertInt:[walter keeperSkill] equals: 2 ]; ! [self assertInt:[walter playmakerSkill] equals: 5 ]; ! [self assertInt:[walter scorerSkill] equals: 2 ]; ! [self assertInt:[walter passingSkill] equals: 5 ]; ! [self assertInt:[walter wingerSkill] equals: 7 ]; ! [self assertInt:[walter defenderSkill] equals: 4 ]; ! [self assertInt:[walter setPiecesSkill] equals: 3 ]; } -(void) testPossiblePlayerSkillsAbilities { NSArray *possibleSkills = [player1 possiblePlayerSkillsAbilities]; ! [self assertInt:[possibleSkills count] equals: 20]; ! [self assertString:[possibleSkills objectAtIndex:0] equals:NSLocalizedString(@"disastrous", @"disastrous")]; ! [self assertString:[possibleSkills objectAtIndex:12] equals:NSLocalizedString(@"world class", @"world class")]; ! [self assertString:[possibleSkills objectAtIndex:19] equals:NSLocalizedString(@"divine", @"divine")]; } -(void) testPossiblePlayerStaminaAbilities { NSArray *possibleSkills = [player1 possiblePlayerStaminaAbilities]; ! [self assertInt:[possibleSkills count] equals: 9]; ! [self assertString:[possibleSkills objectAtIndex:0] equals:NSLocalizedString(@"disastrous", @"disastrous")]; ! [self assertString:[possibleSkills objectAtIndex:8] equals:NSLocalizedString(@"formidable", @"formidable")]; } -(void) testPossiblePlayerFormAbilities { NSArray *possibleSkills = [player1 possiblePlayerFormAbilities]; ! [self assertInt:[possibleSkills count] equals: 8]; ! [self assertString:[possibleSkills objectAtIndex:0] equals:NSLocalizedString(@"disastrous", @"disastrous")]; ! [self assertString:[possibleSkills objectAtIndex:7] equals:NSLocalizedString(@"excellent", @"excellent")]; } -(void) testBestPosition { ! [self assertTrue:[[walter bestPosition] isEqual:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Offensive"]]]; } -(void) testCards { ! [self assertInt:[walter cards] equals:3]; ! [self assertInt:[pirmin cards] equals:0]; ! [self assertInt:[marcel cards] equals:1]; } -(void) testDisqualified { ! [self assertTrue: [walter isDisqualified]]; ! [self assertFalse: [marcel isDisqualified]]; ! [self assertFalse: [pirmin isDisqualified]]; } --- 57,127 ---- - (void)testStamina { ! UKIntsEqual([player1 staminaSkill] ,3 ); } - (void)testCountryID { ! UKIntsEqual([marcel countryID] ,41); ! UKIntsEqual([walter countryID] ,40); } - (void)testCountryName { ! UKStringsEqual([walter countryName] ,@"Schweiz"); } -(void)testPlayerForm { ! UKIntsEqual([player1 playerForm] ,5); } -(void)testLoadedPlayer { ! UKObjectsEqual([walter playerName] , @"Walter Gasparin"); ! UKIntsEqual([walter injuryLevel] , -1 ); ! UKIntsEqual([walter playerForm] , 5 ); ! UKIntsEqual([walter experience] , 4 ); } -(void)testLoadedPlayerSkills { ! UKIntsEqual([walter staminaSkill] , 7 ); ! UKIntsEqual([walter keeperSkill] , 2 ); ! UKIntsEqual([walter playmakerSkill] , 5 ); ! UKIntsEqual([walter scorerSkill] , 2 ); ! UKIntsEqual([walter passingSkill] , 5 ); ! UKIntsEqual([walter wingerSkill] , 7 ); ! UKIntsEqual([walter defenderSkill] , 4 ); ! UKIntsEqual([walter setPiecesSkill] , 3 ); } -(void) testPossiblePlayerSkillsAbilities { NSArray *possibleSkills = [player1 possiblePlayerSkillsAbilities]; ! UKIntsEqual([possibleSkills count] , 20); ! UKStringsEqual([possibleSkills objectAtIndex:0] ,NSLocalizedString(@"disastrous", @"disastrous")); ! UKStringsEqual([possibleSkills objectAtIndex:12] ,NSLocalizedString(@"world class", @"world class")); ! UKStringsEqual([possibleSkills objectAtIndex:19] ,NSLocalizedString(@"divine", @"divine")); } -(void) testPossiblePlayerStaminaAbilities { NSArray *possibleSkills = [player1 possiblePlayerStaminaAbilities]; ! UKIntsEqual([possibleSkills count] , 9); ! UKStringsEqual([possibleSkills objectAtIndex:0] ,NSLocalizedString(@"disastrous", @"disastrous")); ! UKStringsEqual([possibleSkills objectAtIndex:8] ,NSLocalizedString(@"formidable", @"formidable")); } -(void) testPossiblePlayerFormAbilities { NSArray *possibleSkills = [player1 possiblePlayerFormAbilities]; ! UKIntsEqual([possibleSkills count] , 8); ! UKStringsEqual([possibleSkills objectAtIndex:0] ,NSLocalizedString(@"disastrous", @"disastrous")); ! UKStringsEqual([possibleSkills objectAtIndex:7] ,NSLocalizedString(@"excellent", @"excellent")); } -(void) testBestPosition { ! UKTrue([[walter bestPosition] isEqual:[[PositionHeap uniqueInstance] positionWithIdentifier:@"Winger Offensive"]]); } -(void) testCards { ! UKIntsEqual([walter cards] ,3); ! UKIntsEqual([pirmin cards] ,0); ! UKIntsEqual([marcel cards] ,1); } -(void) testDisqualified { ! UKTrue( [walter isDisqualified]); ! UKFalse( [marcel isDisqualified]); ! UKFalse( [pirmin isDisqualified]); } *************** *** 121,127 **** PlayerList *tempPlayerList = [[PlayerList alloc] init]; Player *downloadedPlayer = [tempPlayerList playerAtIndex:0]; ! [self assertNotNil:downloadedPlayer]; ! [self assertTrue:[downloadedPlayer tsi] > 0 message: @"tsi <= 0"]; ! [self assertTrue: [downloadedPlayer keeperSkill] > 0 message: @"keeper <= 0"]; [tempPlayerList release]; --- 129,135 ---- PlayerList *tempPlayerList = [[PlayerList alloc] init]; Player *downloadedPlayer = [tempPlayerList playerAtIndex:0]; ! UKNotNil(downloadedPlayer); ! UKTrue([downloadedPlayer tsi] > 0 ); ! UKTrue( [downloadedPlayer keeperSkill] > 0 ); [tempPlayerList release]; *************** *** 129,157 **** - (void) testSalary { ! [self assertInt:[walter salary] equals:11000]; ! [self assertInt:[marcel salary] equals:9900]; ! [self assertInt:[pirmin salary] equals:11900]; } -(void) testSpecialty { ! [self assertInt:[walter specialty] equals:1]; ! [self assertInt:[marcel specialty] equals:0]; ! [self assertInt:[pirmin specialty] equals:0]; } -(void) testHonesty { ! [self assertInt:[walter honesty] equals:2]; ! [self assertInt:[marcel honesty] equals:2]; ! [self assertInt:[pirmin honesty] equals:2]; } -(void) testAgreeability { ! [self assertInt:[walter agreeability] equals:3]; ! [self assertInt:[marcel agreeability] equals:2]; ! [self assertInt:[pirmin agreeability] equals:1]; } -(void) testAgressiveness { ! [self assertInt:[walter aggressiveness] equals:1]; ! [self assertInt:[marcel aggressiveness] equals:2]; ! [self assertInt:[pirmin aggressiveness] equals:2]; } --- 137,165 ---- - (void) testSalary { ! UKIntsEqual([walter salary] ,11000); ! UKIntsEqual([marcel salary] ,9900); ! UKIntsEqual([pirmin salary] ,11900); } -(void) testSpecialty { ! UKIntsEqual([walter specialty] ,1); ! UKIntsEqual([marcel specialty] ,0); ! UKIntsEqual([pirmin specialty] ,0); } -(void) testHonesty { ! UKIntsEqual([walter honesty] ,2); ! UKIntsEqual([marcel honesty] ,2); ! UKIntsEqual([pirmin honesty] ,2); } -(void) testAgreeability { ! UKIntsEqual([walter agreeability] ,3); ! UKIntsEqual([marcel agreeability] ,2); ! UKIntsEqual([pirmin agreeability] ,1); } -(void) testAgressiveness { ! UKIntsEqual([walter aggressiveness] ,1); ! UKIntsEqual([marcel aggressiveness] ,2); ! UKIntsEqual([pirmin aggressiveness] ,2); } Index: HattrickOrgTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/HattrickOrgTest.m,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** HattrickOrgTest.m 27 Mar 2005 12:23:35 -0000 1.12 --- HattrickOrgTest.m 27 Apr 2005 19:36:45 -0000 1.13 *************** *** 32,35 **** --- 32,43 ---- @implementation HattrickOrgTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void) setUp { } *************** *** 39,48 **** [fileManager removeFileAtPath:[Properties loginFile] handler:nil]; int error = [[HattrickOrg uniqueInstance] login]; ! [self assertInt:error equals:0]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:[Properties loginFile] isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:[Properties loginFile]]; ! [self assertTrue: [file length] > 250]; ! [self assertTrue: [file length] < 350]; } --- 47,56 ---- [fileManager removeFileAtPath:[Properties loginFile] handler:nil]; int error = [[HattrickOrg uniqueInstance] login]; ! UKIntsEqual(error ,0); [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:[Properties loginFile] isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:[Properties loginFile]]; ! UKTrue( [file length] > 250); ! UKTrue( [file length] < 350); } *************** *** 54,61 **** [[HattrickOrg uniqueInstance] downloadPlayers]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 2000]; ! [self assertTrue: [file length] < 100000]; } --- 62,69 ---- [[HattrickOrg uniqueInstance] downloadPlayers]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 2000); ! UKTrue( [file length] < 100000); } *************** *** 67,74 **** [[HattrickOrg uniqueInstance] downloadEconomy]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 75,82 ---- [[HattrickOrg uniqueInstance] downloadEconomy]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 80,87 **** [[HattrickOrg uniqueInstance] downloadTeamDetails]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 88,95 ---- [[HattrickOrg uniqueInstance] downloadTeamDetails]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 93,100 **** [[HattrickOrg uniqueInstance] downloadLeagueDetails]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 101,108 ---- [[HattrickOrg uniqueInstance] downloadLeagueDetails]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 106,113 **** [[HattrickOrg uniqueInstance] downloadClub]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 114,121 ---- [[HattrickOrg uniqueInstance] downloadClub]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 119,126 **** [[HattrickOrg uniqueInstance] downloadTraining]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 127,134 ---- [[HattrickOrg uniqueInstance] downloadTraining]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 132,139 **** [[HattrickOrg uniqueInstance] downloadArenaDetails]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 140,147 ---- [[HattrickOrg uniqueInstance] downloadArenaDetails]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 145,152 **** [[HattrickOrg uniqueInstance] downloadWorldDetails]; [[HattrickOrg uniqueInstance] logout]; ! [self assertTrue: [fileManager fileExistsAtPath:filename isDirectory:NO]]; NSString *file = [NSString stringWithContentsOfFile:filename]; ! [self assertTrue: [file length] > 200]; ! [self assertTrue: [file length] < 100000]; } --- 153,160 ---- [[HattrickOrg uniqueInstance] downloadWorldDetails]; [[HattrickOrg uniqueInstance] logout]; ! UKTrue( [fileManager fileExistsAtPath:filename isDirectory:NO]); NSString *file = [NSString stringWithContentsOfFile:filename]; ! UKTrue( [file length] > 200); ! UKTrue( [file length] < 100000); } *************** *** 155,165 **** [[HattrickOrg uniqueInstance] downloadPlayers]; NSFileManager *fileManager = [NSFileManager defaultManager]; ! [self assertTrue: [fileManager fileExistsAtPath:[Properties playersFile] isDirectory:NO]]; NSString *playersFile = [NSString stringWithContentsOfFile:[Properties playersFile]]; ! [self assertTrue: [playersFile length] > 20000]; [[HattrickOrg uniqueInstance] logout]; [[HattrickOrg uniqueInstance] downloadPlayers]; NSString *playersFileNew = [NSString stringWithContentsOfFile:[Properties playersFile]]; ! [self assertTrue: [playersFileNew length] < 20000]; // replace the incorrect file with the correct one [[HattrickOrg uniqueInstance] login]; --- 163,173 ---- [[HattrickOrg uniqueInstance] downloadPlayers]; NSFileManager *fileManager = [NSFileManager defaultManager]; ! UKTrue( [fileManager fileExistsAtPath:[Properties playersFile] isDirectory:NO]); NSString *playersFile = [NSString stringWithContentsOfFile:[Properties playersFile]]; ! UKTrue( [playersFile length] > 20000); [[HattrickOrg uniqueInstance] logout]; [[HattrickOrg uniqueInstance] downloadPlayers]; NSString *playersFileNew = [NSString stringWithContentsOfFile:[Properties playersFile]]; ! UKTrue( [playersFileNew length] < 20000); // replace the incorrect file with the correct one [[HattrickOrg uniqueInstance] login]; *************** *** 172,176 **** [[HattrickOrg uniqueInstance] setServerName:@"www.hattttrick.org"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! [self assertTrue: errorCode != 0]; [[HattrickOrg uniqueInstance] setServerName:currentServerName]; [currentServerName release]; --- 180,184 ---- [[HattrickOrg uniqueInstance] setServerName:@"www.hattttrick.org"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! UKTrue( errorCode != 0); [[HattrickOrg uniqueInstance] setServerName:currentServerName]; [currentServerName release]; *************** *** 180,184 **** [[HattrickOrg uniqueInstance] setLoginName:@"testli"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! [self assertInt: errorCode equals: -3]; [[HattrickOrg uniqueInstance] setLoginName:currentLoginname]; [currentLoginname release]; --- 188,192 ---- [[HattrickOrg uniqueInstance] setLoginName:@"testli"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! UKIntsEqual( errorCode , -3); [[HattrickOrg uniqueInstance] setLoginName:currentLoginname]; [currentLoginname release]; *************** *** 189,193 **** [[HattrickOrg uniqueInstance] setPassword:@"testli"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! [self assertInt: errorCode equals: -3]; [[HattrickOrg uniqueInstance] setPassword:currentPassword]; [currentPassword release]; --- 197,201 ---- [[HattrickOrg uniqueInstance] setPassword:@"testli"]; int errorCode = [[HattrickOrg uniqueInstance] login]; ! UKIntsEqual( errorCode , -3); [[HattrickOrg uniqueInstance] setPassword:currentPassword]; [currentPassword release]; Index: EconomyTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/EconomyTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EconomyTest.h 4 Dec 2004 14:26:04 -0000 1.2 --- EconomyTest.h 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 27,35 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import "Properties.h" #import "Economy.h" ! @interface EconomyTest : TestCase { Economy *economyLocal; } --- 27,35 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import "Properties.h" #import "Economy.h" ! @interface EconomyTest : NSObject <UKTest> { Economy *economyLocal; } Index: UserTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/UserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UserTest.h 26 Sep 2004 13:45:38 -0000 1.1 --- UserTest.h 27 Apr 2005 19:36:45 -0000 1.2 *************** *** 28,35 **** #import <Cocoa/Cocoa.h> ! #import <ObjcUnit/ObjcUnit.h> #import "User.h" ! @interface UserTest : TestCase { } --- 28,35 ---- #import <Cocoa/Cocoa.h> ! #import <UnitKit/UnitKit.h> #import "User.h" ! @interface UserTest : NSObject <UKTest> { } Index: PlayerTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerTest.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PlayerTest.h 28 Nov 2004 14:07:05 -0000 1.5 --- PlayerTest.h 27 Apr 2005 19:36:45 -0000 1.6 *************** *** 27,35 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> @class Player; ! @interface PlayerTest : TestCase { Player *player1; Player *walter; --- 27,35 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> @class Player; ! @interface PlayerTest : NSObject <UKTest> { Player *player1; Player *walter; Index: EconomyTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/EconomyTest.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EconomyTest.m 4 Dec 2004 14:26:04 -0000 1.3 --- EconomyTest.m 27 Apr 2005 19:36:45 -0000 1.4 *************** *** 33,36 **** --- 33,44 ---- + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + -(void) setUp { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; *************** *** 46,104 **** -(void) testInitWithLocalFile { ! [self assertNotNil:economyLocal]; ! [self assertInt:[economyLocal cash] equals:3292300]; ! [self assertInt:[economyLocal expectedCash] equals:4329401]; ! [self assertInt:[economyLocal sponsorsPopularity] equals:8]; ! [self assertInt:[economyLocal supportersPopularity] equals:7]; ! [self assertInt:[economyLocal fanClubSize] equals:1187]; ! [self assertInt:[economyLocal incomeSpectators] equals:1399925]; ! [self assertInt:[economyLocal incomeSponsors] equals:608850]; ! [self assertInt:[economyLocal incomeFinancial] equals:0]; ! [self assertInt:[economyLocal incomeTemporary] equals:0]; ! [self assertInt:[economyLocal incomeSum] equals:2008775]; ! [self assertInt:[economyLocal costsArena] equals:160000]; ! [self assertInt:[economyLocal costsPlayers] equals:231674]; ! [self assertInt:[economyLocal costsFinancial] equals:0]; ! [self assertInt:[economyLocal costsTemporary] equals:20000]; ! [self assertInt:[economyLocal costsStaff] equals:360000]; ! [self assertInt:[economyLocal costsYouth] equals:200000]; ! [self assertInt:[economyLocal costsSum] equals:971674]; ! [self assertInt:[economyLocal expectedWeeksTotal] equals:1037101]; ! [self assertInt:[economyLocal lastIncomeSpectators] equals:26150]; ! [self assertInt:[economyLocal lastIncomeSponsors] equals:600600]; ! [self assertInt:[economyLocal lastIncomeFinancial] equals:0]; ! [self assertInt:[economyLocal lastIncomeTemporary] equals:464709]; ! [self assertInt:[economyLocal lastIncomeSum] equals:1091459]; ! [self assertInt:[economyLocal lastCostsArena] equals:160000]; ! [self assertInt:[economyLocal lastCostsPlayers] equals:222277]; ! [self assertInt:[economyLocal lastCostsFinancial] equals:0]; ! [self assertInt:[economyLocal lastCostsTemporary] equals:7865565]; ! [self assertInt:[economyLocal lastCostsStaff] equals:405000]; ! [self assertInt:[economyLocal lastCostsYouth] equals:200000]; ! [self assertInt:[economyLocal lastCostsSum] equals:8852842]; ! [self assertInt:[economyLocal lastWeeksTotal] equals:-7761383]; } -(void) testDownload { Economy* economy = [[Economy alloc] init]; ! [self assertNotNil:economy message: @"is nil"]; ! [self assertTrue:[economy incomeSponsors] > 0 message: @"incomeSponsors"]; ! [self assertTrue:[economy incomeSum] > 0 message: @"incomeSum"]; ! [self assertTrue:[economy costsSum] > 0 message: @"costsSum"]; ! [self assertTrue:[economy lastIncomeSum] > 0 message: @"lastIncomeSum"]; ! [self assertTrue:[economy lastCostsSum] > 0 message: @"lastCostsSum"]; ! [self assertNotNil:[economy currencyName] message: @"currency name nil"]; ! [self assertTrue:[economy currencyRate] > 0 message:@"currency rate <= 0"]; [economy release]; } - (void) testTwoWeeksBalance { ! [self assertInt:[economyLocal twoWeeksBalance] equals:696574]; ! [self assertInt:[economyLocal twoWeeksBalance] equals: ([economyLocal incomeSum]-[economyLocal incomeTemporary]) + ([economyLocal lastIncomeSum] - [economyLocal lastIncomeTemporary]) - ([economyLocal costsSum] - [economyLocal costsTemporary]) - ([economyLocal lastCostsSum] - [economyLocal lastCostsTemporary]) ! ]; } --- 54,112 ---- -(void) testInitWithLocalFile { ! UKNotNil(economyLocal); ! UKIntsEqual([economyLocal cash] ,3292300); ! UKIntsEqual([economyLocal expectedCash] ,4329401); ! UKIntsEqual([economyLocal sponsorsPopularity] ,8); ! UKIntsEqual([economyLocal supportersPopularity] ,7); ! UKIntsEqual([economyLocal fanClubSize] ,1187); ! UKIntsEqual([economyLocal incomeSpectators] ,1399925); ! UKIntsEqual([economyLocal incomeSponsors] ,608850); ! UKIntsEqual([economyLocal incomeFinancial] ,0); ! UKIntsEqual([economyLocal incomeTemporary] ,0); ! UKIntsEqual([economyLocal incomeSum] ,2008775); ! UKIntsEqual([economyLocal costsArena] ,160000); ! UKIntsEqual([economyLocal costsPlayers] ,231674); ! UKIntsEqual([economyLocal costsFinancial] ,0); ! UKIntsEqual([economyLocal costsTemporary] ,20000); ! UKIntsEqual([economyLocal costsStaff] ,360000); ! UKIntsEqual([economyLocal costsYouth] ,200000); ! UKIntsEqual([economyLocal costsSum] ,971674); ! UKIntsEqual([economyLocal expectedWeeksTotal] ,1037101); ! UKIntsEqual([economyLocal lastIncomeSpectators] ,26150); ! UKIntsEqual([economyLocal lastIncomeSponsors] ,600600); ! UKIntsEqual([economyLocal lastIncomeFinancial] ,0); ! UKIntsEqual([economyLocal lastIncomeTemporary] ,464709); ! UKIntsEqual([economyLocal lastIncomeSum] ,1091459); ! UKIntsEqual([economyLocal lastCostsArena] ,160000); ! UKIntsEqual([economyLocal lastCostsPlayers] ,222277); ! UKIntsEqual([economyLocal lastCostsFinancial] ,0); ! UKIntsEqual([economyLocal lastCostsTemporary] ,7865565); ! UKIntsEqual([economyLocal lastCostsStaff] ,405000); ! UKIntsEqual([economyLocal lastCostsYouth] ,200000); ! UKIntsEqual([economyLocal lastCostsSum] ,8852842); ! UKIntsEqual([economyLocal lastWeeksTotal] ,-7761383); } -(void) testDownload { Economy* economy = [[Economy alloc] init]; ! UKNotNil(economy ); ! UKTrue([economy incomeSponsors] > 0 ); ! UKTrue([economy incomeSum] > 0 ); ! UKTrue([economy costsSum] > 0 ); ! UKTrue([economy lastIncomeSum] > 0 ); ! UKTrue([economy lastCostsSum] > 0 ); ! UKNotNil([economy currencyName]); ! UKTrue([economy currencyRate] > 0 ); [economy release]; } - (void) testTwoWeeksBalance { ! UKIntsEqual([economyLocal twoWeeksBalance] ,696574); ! UKIntsEqual([economyLocal twoWeeksBalance], ([economyLocal incomeSum]-[economyLocal incomeTemporary]) + ([economyLocal lastIncomeSum] - [economyLocal lastIncomeTemporary]) - ([economyLocal costsSum] - [economyLocal costsTemporary]) - ([economyLocal lastCostsSum] - [economyLocal lastCostsTemporary]) ! ); } Index: ArenaTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/ArenaTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArenaTest.h 21 Sep 2004 17:02:14 -0000 1.1 --- ArenaTest.h 27 Apr 2005 19:36:44 -0000 1.2 *************** *** 27,34 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import "Arena.h" ! @interface ArenaTest : TestCase { } --- 27,34 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import "Arena.h" ! @interface ArenaTest : NSObject <UKTest> { } Index: PlayerListTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerListTest.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PlayerListTest.m 28 Nov 2004 14:07:05 -0000 1.5 --- PlayerListTest.m 27 Apr 2005 19:36:45 -0000 1.6 *************** *** 31,34 **** --- 31,42 ---- @implementation PlayerListTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void)setUp { playerListLocal = [[PlayerList alloc] initFromXML: *************** *** 50,59 **** for(i = 0; i<26;i++) { ! [self assertInt: [[playerListLocal playerAtIndex:i] playerID] equals: ids[i]]; } } - (void)testInitFromXML { ! [self assertInt:[playerListLocal numberOfPlayers] equals: 26]; } --- 58,67 ---- for(i = 0; i<26;i++) { ! UKIntsEqual( [[playerListLocal playerAtIndex:i] playerID] , ids[i]); } } - (void)testInitFromXML { ! UKIntsEqual([playerListLocal numberOfPlayers] , 26); } *************** *** 62,66 **** - (void)testDownload { playerListDownload = [[PlayerList alloc] init]; ! [self assertTrue: [[playerListDownload playerList] count] > 0]; [playerListDownload release]; } --- 70,74 ---- - (void)testDownload { playerListDownload = [[PlayerList alloc] init]; ! UKTrue( [[playerListDownload playerList] count] > 0); [playerListDownload release]; } *************** *** 68,86 **** - (void) testNonInjuredPlayers { NSArray *nonInjured = [playerListLocal playersWithInjured:NO diqualified:YES]; ! [self assertInt:[nonInjured count] equals:24]; } - (void) testNonDiqualified { NSArray *nonDisqualified = [playerListLocal playersWithInjured:YES diqualified:NO]; ! [self assertInt:[nonDisqualified count] equals:25]; } - (void) testPlayerWithID { Player *marcel = [playerListLocal playerWithID:17108671]; ! //[self assertNil: marcel message:@"marcel nil" ]; ! [self assertString:[marcel playerName] equals:@"Marcel Saledad"]; Player *hezi = [playerListLocal playerWithID:10589359]; ! //[self assertNotNil: hezi message:@"hezi nil" ]; ! [self assertString:[hezi playerName] equals:@"Hezi Arad"]; } --- 76,94 ---- - (void) testNonInjuredPlayers { NSArray *nonInjured = [playerListLocal playersWithInjured:NO diqualified:YES]; ! UKIntsEqual([nonInjured count] ,24); } - (void) testNonDiqualified { NSArray *nonDisqualified = [playerListLocal playersWithInjured:YES diqualified:NO]; ! UKIntsEqual([nonDisqualified count] ,25); } - (void) testPlayerWithID { Player *marcel = [playerListLocal playerWithID:17108671]; ! //UKNil( marcel ); ! UKStringsEqual([marcel playerName] ,@"Marcel Saledad"); Player *hezi = [playerListLocal playerWithID:10589359]; ! //UKNotNil( hezi ); ! UKStringsEqual([hezi playerName] ,@"Hezi Arad"); } *************** *** 88,92 **** - (void) testTotalTsi { playerListDownload = [[PlayerList alloc] init]; ! [self assertTrue: [playerListDownload totalTSI] > 100 message: @"total tsi <= 100"]; [playerListDownload release]; } --- 96,100 ---- - (void) testTotalTsi { playerListDownload = [[PlayerList alloc] init]; ! UKTrue( [playerListDownload totalTSI] > 100 ); [playerListDownload release]; } *************** *** 94,107 **** - (void) testAverageTsi { playerListDownload = [[PlayerList alloc] init]; ! [self assertTrue: [playerListDownload averageTSI] > 10 message: @"average tsi <= 10"]; ! [self assertInt:[playerListDownload averageTSI] equals:[playerListDownload totalTSI]/[playerListDownload numberOfPlayers]]; [playerListDownload release]; } - (void) testAverageAge { ! [self assertFloat:[playerListLocal averageAge] equals:24.53 precision:0.1]; playerListDownload = [[PlayerList alloc] init]; ! [self assertTrue:[playerListDownload averageAge] > 17 message: @"average age <= 17"]; ! [self assertTrue:[playerListDownload averageAge] < 40 message: @"average age >= 40"]; [playerListDownload release]; } --- 102,115 ---- - (void) testAverageTsi { playerListDownload = [[PlayerList alloc] init]; ! UKTrue( [playerListDownload averageTSI] > 10 ); ! UKIntsEqual([playerListDownload averageTSI] ,[playerListDownload totalTSI]/[playerListDownload numberOfPlayers]); [playerListDownload release]; } - (void) testAverageAge { ! UKFloatsEqual([playerListLocal averageAge] ,24.53 ,0.1); playerListDownload = [[PlayerList alloc] init]; ! UKTrue([playerListDownload averageAge] > 17 ); ! UKTrue([playerListDownload averageAge] < 40 ); [playerListDownload release]; } Index: LineUpTreeTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LineUpTreeTest.h 13 Sep 2004 19:38:25 -0000 1.2 --- LineUpTreeTest.h 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 27,31 **** //---- eo licence ------------------------------------------------------------// #import <Foundation/Foundation.h> ! #import <ObjcUnit/ObjcUnit.h> #import "LineUpTree.h" #import "LineUpTreeLayer.h" --- 27,31 ---- //---- eo licence ------------------------------------------------------------// #import <Foundation/Foundation.h> ! #import <UnitKit/UnitKit.h> #import "LineUpTree.h" #import "LineUpTreeLayer.h" *************** *** 33,37 **** #import "PlayerList.h" ! @interface LineUpTreeTest : TestCase { PlayerList *playerList; LineUpTree *lineUpTree; --- 33,37 ---- #import "PlayerList.h" ! @interface LineUpTreeTest : NSObject <UKTest> { PlayerList *playerList; LineUpTree *lineUpTree; Index: PlayerListTest.h =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerListTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlayerListTest.h 26 Sep 2004 12:04:10 -0000 1.2 --- PlayerListTest.h 27 Apr 2005 19:36:45 -0000 1.3 *************** *** 27,31 **** //---- eo licence ------------------------------------------------------------// ! #import <ObjcUnit/ObjcUnit.h> #import "AllTests.h" #import "HattrickOrg.h" --- 27,31 ---- //---- eo licence ------------------------------------------------------------// ! #import <UnitKit/UnitKit.h> #import "AllTests.h" #import "HattrickOrg.h" *************** *** 34,38 **** #import "Player.h" ! @interface PlayerListTest : TestCase { PlayerList *playerListDownload; PlayerList *playerListLocal; --- 34,38 ---- #import "Player.h" ! @interface PlayerListTest : NSObject <UKTest> { PlayerList *playerListDownload; PlayerList *playerListLocal; Index: LineUpTreeTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeTest.m,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** LineUpTreeTest.m 25 Apr 2005 20:23:02 -0000 1.11 --- LineUpTreeTest.m 27 Apr 2005 19:36:45 -0000 1.12 *************** *** 35,38 **** --- 35,46 ---- @implementation LineUpTreeTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void)setUp { playerList = [[PlayerList alloc] initFromXML: *************** *** 46,57 **** [lineUpTree buildTree: 0.98 playerList: playerSet]; LineUpTreeLayer *finalLayer = [lineUpTree finalLayer]; ! [self assertNotNil:finalLayer]; ! [self assertTrue: ([[finalLayer layerNodes] count] >70) ]; NSArray *lineUp = [lineUpTree bestLineUp]; ! [self assertInt:[lineUp count] equals:11]; NSEnumerator *en = [lineUp objectEnumerator]; LineUpTreeNode *node; while (node = [en nextObject]) { ! [self assertNotNil: [[node player] playerName]]; } } --- 54,65 ---- [lineUpTree buildTree: 0.98 playerList: playerSet]; LineUpTreeLayer *finalLayer = [lineUpTree finalLayer]; ! UKNotNil(finalLayer); ! UKTrue( ([[finalLayer layerNodes] count] >70) ); NSArray *lineUp = [lineUpTree bestLineUp]; ! UKIntsEqual([lineUp count] ,11); NSEnumerator *en = [lineUp objectEnumerator]; LineUpTreeNode *node; while (node = [en nextObject]) { ! UKNotNil( [[node player] playerName]); } } *************** *** 76,83 **** NSSet *playerSet = [NSSet setWithArray:[playerList playerList]]; [lineUpTree buildTree: 0.99 playerList: playerSet]; ! [self assertFloat: [lineUpTree strength:@"Total"] equals:40.0 precision:1.5]; ! [self assertFloat: [lineUpTree strength:@"Defense"] equals:16.0 precision:1.5]; ! [self assertFloat: [lineUpTree strength:@"Midfield"] equals:18.0 precision:1.5]; ! [self assertFloat: [lineUpTree strength:@"Attack"] equals:6 precision:1.5]; } --- 84,91 ---- NSSet *playerSet = [NSSet setWithArray:[playerList playerList]]; [lineUpTree buildTree: 0.99 playerList: playerSet]; ! UKFloatsEqual( [lineUpTree strength:@"Total"] ,40.0 ,1.5); ! UKFloatsEqual( [lineUpTree strength:@"Defense"] ,16.0 ,1.5); ! UKFloatsEqual( [lineUpTree strength:@"Midfield"] ,18.0 ,1.5); ! UKFloatsEqual( [lineUpTree strength:@"Attack"] ,6 ,1.5); } Index: AllTests.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/AllTests.m,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AllTests.m 7 Feb 2005 21:16:28 -0000 1.19 --- AllTests.m 27 Apr 2005 19:36:44 -0000 1.20 *************** *** 52,56 **** @implementation AllTests ! + (AllTests *)suite { return [[[self alloc] initWithName:@"All Example Tests"] autorelease]; --- 52,56 ---- @implementation AllTests ! /* + (AllTests *)suite { return [[[self alloc] initWithName:@"All Example Tests"] autorelease]; *************** *** 81,84 **** --- 81,85 ---- return self; } + */ +(id) getProperty: (id) aKey { *************** *** 96,98 **** } ! @end \ No newline at end of file --- 97,99 ---- } ! @end Index: PositionTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PositionTest.m,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PositionTest.m 25 Apr 2005 20:23:02 -0000 1.10 --- PositionTest.m 27 Apr 2005 19:36:45 -0000 1.11 *************** *** 32,35 **** --- 32,43 ---- @implementation PositionTest + - (id) init { + self = [super init]; + if(self) { + [self setUp]; + } + return self; + } + - (void) setUp { positionKeeper = [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Keeper"]; *************** *** 53,151 **** - (void) testPositionKeeper{ ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Keeper"]] equals: 6 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Keeper"]] equals: 1 precision:0.1]; } - (void) testPositionCentralDefender { ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender"]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderTowardsWing { ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender Towards Wing"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender Towards Wing"]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderOffensive { ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender Offensive"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Central Defender Offensive"]] equals: 3.9 precision:0.1]; } - (void) testPositionWingBack { ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Wingback"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Wingback"]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackTowardsMiddle { ! [self assertFloat:[player1 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Wingback Towards Middle"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [[PositionHeap uniqueInstance] defaultPositionWithIdentifier:@"Wingback Towards Middle"]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackDefensive { !... [truncated message content] |