|
From: Geisschaes <gei...@us...> - 2005-01-24 20:21:58
|
Update of /cvsroot/macattrick/macattrick/Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1323/Test Modified Files: LineUpTreeLayerTest.m LineUpTreeNodeTest.m LineUpTreeTest.m PlayerSortingTest.m PlayerTest.m PositionTest.m Log Message: new positions philosophy added Index: PlayerTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerTest.m,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PlayerTest.m 15 Jan 2005 17:39:53 -0000 1.13 --- PlayerTest.m 24 Jan 2005 20:20:42 -0000 1.14 *************** *** 103,107 **** -(void) testBestPosition { ! [self assertTrue:[[walter bestPosition] isEqual:[Position positionWingerOffensive]]]; } --- 103,107 ---- -(void) testBestPosition { ! [self assertTrue:[[walter bestPosition] isEqual:[Position positionWithIdentifier:@"Winger Offensive"]]]; } Index: PlayerSortingTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PlayerSortingTest.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlayerSortingTest.m 29 Jun 2004 10:18:10 -0000 1.2 --- PlayerSortingTest.m 24 Jan 2005 20:20:42 -0000 1.3 *************** *** 43,47 **** } ! - (void) testNameComparison { [self assertInt: [player1 playerNameComparison:player2] equals: NSOrderedAscending]; [self assertInt: [player2 playerNameComparison:player1] equals: NSOrderedDescending]; --- 43,47 ---- } ! /*- (void) testNameComparison { [self assertInt: [player1 playerNameComparison:player2] equals: NSOrderedAscending]; [self assertInt: [player2 playerNameComparison:player1] equals: NSOrderedDescending]; *************** *** 88,92 **** [self assertInt: [player1 defenderSkillComparison:player1] equals: NSOrderedSame]; [self assertInt: [player2 defenderSkillComparison:player1] equals: NSOrderedDescending]; ! } - (void) testSetPiecesComparison { --- 88,92 ---- [self assertInt: [player1 defenderSkillComparison:player1] equals: NSOrderedSame]; [self assertInt: [player2 defenderSkillComparison:player1] equals: NSOrderedDescending]; ! }*/ - (void) testSetPiecesComparison { Index: LineUpTreeLayerTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeLayerTest.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LineUpTreeLayerTest.m 9 Jun 2004 19:35:36 -0000 1.3 --- LineUpTreeLayerTest.m 24 Jan 2005 20:20:40 -0000 1.4 *************** *** 55,61 **** [player3 setExperience:1]; [player3 setPlayerForm:8]; ! position1 = [Position positionKeeper]; ! position2 = [Position positionInnerMidfield]; ! position3 = [Position positionForward]; rootLayer = [[LineUpTreeLayer alloc] initWithTreshold: 0 position: nil]; LineUpTreeNode *node = [[LineUpTreeNode alloc] initWithPlayer:nil --- 55,61 ---- [player3 setExperience:1]; [player3 setPlayerForm:8]; ! position1 = [Position positionWithIdentifier:@"Keeper"]; ! position2 = [Position positionWithIdentifier:@"Inner Midfield"]; ! position3 = [Position positionWithIdentifier:@"Forward"]; rootLayer = [[LineUpTreeLayer alloc] initWithTreshold: 0 position: nil]; LineUpTreeNode *node = [[LineUpTreeNode alloc] initWithPlayer:nil Index: PositionTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/PositionTest.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PositionTest.m 22 Jul 2004 11:54:03 -0000 1.6 --- PositionTest.m 24 Jan 2005 20:20:42 -0000 1.7 *************** *** 33,38 **** - (void) setUp { ! positionKeeper = [Position positionKeeper]; ! positionWinger = [Position positionWinger]; player1 = [[Player alloc] init]; [player1 setStaminaSkill: 6 keeperSkill: 6 --- 33,38 ---- - (void) setUp { ! positionKeeper = [Position defaultPositionWithIdentifier:@"Keeper"]; ! positionWinger = [Position defaultPositionWithIdentifier:@"Winger"]; player1 = [[Player alloc] init]; [player1 setStaminaSkill: 6 keeperSkill: 6 *************** *** 53,133 **** - (void) testPositionKeeper{ ! [self assertFloat:[player1 calculatePositionValue: [Position positionKeeper]] equals: 6 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionKeeper]] equals: 1 precision:0.1]; } - (void) testPositionCentralDefender { ! [self assertFloat:[player1 calculatePositionValue: [Position positionCentralDefender]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionCentralDefender]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderTowardsWing { ! [self assertFloat:[player1 calculatePositionValue: [Position positionCentralDefenderTowardsWing]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionCentralDefenderTowardsWing]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionCentralDefenderOffensive]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionCentralDefenderOffensive]] equals: 3.9 precision:0.1]; } - (void) testPositionWingBack { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingback]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingback]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackTowardsMiddle { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingbackTowardsMiddle]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingbackTowardsMiddle]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingbackDefensive]] equals: 1.3 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingbackDefensive]] equals: 3.3 precision:0.1]; } - (void) testPositionWingBackOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingbackOffensive]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingbackOffensive]] equals: 4.2 precision:0.1]; } - (void) testPositionInnerMidfield { ! [self assertFloat:[player1 calculatePositionValue: [Position positionInnerMidfield]] equals: 2.3 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionInnerMidfield]] equals: 6.5 precision:0.1]; } - (void) testPositionInnerMidfieldTowardsWing { ! [self assertFloat:[player1 calculatePositionValue: [Position positionInnerMidfieldTowardsWing]] equals: 2 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionInnerMidfieldTowardsWing]] equals: 5.8 precision:0.1]; } - (void) testPositionInnerMidfieldOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionInnerMidfieldOffensive]] equals: 2 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionInnerMidfieldOffensive]] equals: 6.3 precision:0.1]; } - (void) testPositionInnerMidfieldDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionInnerMidfieldDefensive]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionInnerMidfieldDefensive]] equals: 6.1 precision:0.1]; } - (void) testPositionWinger { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWinger]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWinger]] equals: 5.3 precision:0.1]; } - (void) testPositionWingerTowardsMiddle { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingerTowardsMiddle]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingerTowardsMiddle]] equals: 5.4 precision:0.1]; } - (void) testPositionWingerOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingerOffensive]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingerOffensive]] equals: 4.9 precision:0.1]; } - (void) testPositionWingerDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionWingerDefensive]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionWingerDefensive]] equals: 4.8 precision:0.1]; } - (void) testPositionForward { ! [self assertFloat:[player1 calculatePositionValue: [Position positionForward]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionForward]] equals: 4 precision:0.1]; } - (void) testPositionForwardDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position positionForwardDefensive]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position positionForwardDefensive]] equals: 4.5 precision:0.1]; } ! -(void) testIsEqual { ! [self assertTrue:[positionKeeper isEqual: positionKeeper]]; ! [self assertFalse:[positionKeeper isEqual: positionWinger]]; ! [self assertTrue:[positionWinger isEqual: [Position positionWinger]]]; } --- 53,138 ---- - (void) testPositionKeeper{ ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Keeper"]] equals: 6 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Keeper"]] equals: 1 precision:0.1]; } - (void) testPositionCentralDefender { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender"]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderTowardsWing { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender Towards Wing"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender Towards Wing"]] equals: 3.5 precision:0.1]; } - (void) testPositionCentralDefenderOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender Offensive"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Central Defender Offensive"]] equals: 3.9 precision:0.1]; } - (void) testPositionWingBack { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback"]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackTowardsMiddle { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Towards Middle"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Towards Middle"]] equals: 3.6 precision:0.1]; } - (void) testPositionWingBackDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Defensive"]] equals: 1.3 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Defensive"]] equals: 3.3 precision:0.1]; } - (void) testPositionWingBackOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Offensive"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Wingback Offensive"]] equals: 4.2 precision:0.1]; } - (void) testPositionInnerMidfield { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield"]] equals: 2.3 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield"]] equals: 6.5 precision:0.1]; } - (void) testPositionInnerMidfieldTowardsWing { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Towards Wing"]] equals: 2 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Towards Wing"]] equals: 5.8 precision:0.1]; } - (void) testPositionInnerMidfieldOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Offensive"]] equals: 2 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Offensive"]] equals: 6.3 precision:0.1]; } - (void) testPositionInnerMidfieldDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Defensive"]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Inner Midfield Defensive"]] equals: 6.1 precision:0.1]; } - (void) testPositionWinger { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger"]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger"]] equals: 5.3 precision:0.1]; } - (void) testPositionWingerTowardsMiddle { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Towards Middle"]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Towards Middle"]] equals: 5.4 precision:0.1]; } - (void) testPositionWingerOffensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Offensive"]] equals: 1.8 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Offensive"]] equals: 4.9 precision:0.1]; } - (void) testPositionWingerDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Defensive"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Winger Defensive"]] equals: 4.8 precision:0.1]; } - (void) testPositionForward { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Forward"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Forward"]] equals: 4 precision:0.1]; } - (void) testPositionForwardDefensive { ! [self assertFloat:[player1 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Forward Defensive"]] equals: 1.5 precision:0.1]; ! [self assertFloat:[player2 calculatePositionValue: [Position defaultPositionWithIdentifier:@"Forward Defensive"]] equals: 4.5 precision:0.1]; } ! - (void) testSaveToUserDefaults { ! [positionKeeper saveToUserDefaults]; ! [self assertNotNil:[[NSUserDefaults standardUserDefaults] arrayForKey:@"Keeper"]]; ! Position *newKeeper = [[Position alloc] initFromUserDefaults:@"Keeper"]; ! [self assert:positionKeeper equals:newKeeper]; ! } -(void) testIsEqual { ! [self assertTrue:[positionKeeper isEqual: [Position positionWithIdentifier:@"Keeper"]]]; ! [self assertFalse:[positionKeeper isEqual: [Position positionWithIdentifier:@"Winger"]]]; ! [self assertTrue:[positionWinger isEqual: [Position positionWithIdentifier:@"Winger"]]]; } *************** *** 135,139 **** NSArray *possiblePositions = [Position possiblePositions]; [self assertInt:[possiblePositions count] equals:18]; ! [self assertTrue:[possiblePositions containsObject:[Position positionInnerMidfieldTowardsWing]]]; } --- 140,144 ---- NSArray *possiblePositions = [Position possiblePositions]; [self assertInt:[possiblePositions count] equals:18]; ! [self assertTrue:[possiblePositions containsObject:[Position positionWithIdentifier:@"Inner Midfield Towards Wing"]]]; } Index: LineUpTreeNodeTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeNodeTest.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LineUpTreeNodeTest.m 29 Jun 2004 10:18:10 -0000 1.4 --- LineUpTreeNodeTest.m 24 Jan 2005 20:20:42 -0000 1.5 *************** *** 55,60 **** [player3 setExperience:1]; [player3 setPlayerForm:8]; ! position1 = [Position positionKeeper]; ! position2 = [Position positionInnerMidfield]; root = [[LineUpTreeNode alloc] initWithPlayer: player1 stillAvailablePlayers: [NSSet setWithObjects:player2, player3, nil] --- 55,60 ---- [player3 setExperience:1]; [player3 setPlayerForm:8]; ! position1 = [Position positionWithIdentifier:@"Keeper"]; ! position2 = [Position positionWithIdentifier:@"Inner Midfield"]; root = [[LineUpTreeNode alloc] initWithPlayer: player1 stillAvailablePlayers: [NSSet setWithObjects:player2, player3, nil] Index: LineUpTreeTest.m =================================================================== RCS file: /cvsroot/macattrick/macattrick/Test/LineUpTreeTest.m,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LineUpTreeTest.m 19 Sep 2004 17:06:46 -0000 1.8 --- LineUpTreeTest.m 24 Jan 2005 20:20:42 -0000 1.9 *************** *** 58,72 **** - (NSArray*) defaultPositions442 { NSMutableArray *positions = [NSMutableArray arrayWithCapacity:11]; ! [positions addObject:[Position positionKeeper]]; ! [positions addObject:[Position positionCentralDefender]]; ! [positions addObject:[Position positionCentralDefender]]; ! [positions addObject:[Position positionWingback]]; ! [positions addObject:[Position positionWingback]]; ! [positions addObject:[Position positionInnerMidfield]]; ! [positions addObject:[Position positionInnerMidfield]]; ! [positions addObject:[Position positionWinger]]; ! [positions addObject:[Position positionWinger]]; ! [positions addObject:[Position positionForward]]; ! [positions addObject:[Position positionForward]]; return positions; } --- 58,72 ---- - (NSArray*) defaultPositions442 { NSMutableArray *positions = [NSMutableArray arrayWithCapacity:11]; ! [positions addObject:[Position positionWithIdentifier:@"Keeper"]]; ! [positions addObject:[Position positionWithIdentifier:@"Central Defender"]]; ! [positions addObject:[Position positionWithIdentifier:@"Central Defender"]]; ! [positions addObject:[Position positionWithIdentifier:@"Wingback"]]; ! [positions addObject:[Position positionWithIdentifier:@"Wingback"]]; ! [positions addObject:[Position positionWithIdentifier:@"Inner Midfield"]]; ! [positions addObject:[Position positionWithIdentifier:@"Inner Midfield"]]; ! [positions addObject:[Position positionWithIdentifier:@"Winger"]]; ! [positions addObject:[Position positionWithIdentifier:@"Winger"]]; ! [positions addObject:[Position positionWithIdentifier:@"Forward"]]; ! [positions addObject:[Position positionWithIdentifier:@"Forward"]]; return positions; } |