Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WarGames
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Bieszczad-Stie
WarGames
Commits
518cbccb
Commit
518cbccb
authored
3 years ago
by
Eric Bieszczad-Stie
Browse files
Options
Downloads
Patches
Plain Diff
More readable test code in BattleTest
parent
86655d9c
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#171264
failed
3 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/edu/ntnu/ericbi/wargames/BattleTest.java
+10
-6
10 additions, 6 deletions
src/test/java/edu/ntnu/ericbi/wargames/BattleTest.java
with
10 additions
and
6 deletions
src/test/java/edu/ntnu/ericbi/wargames/BattleTest.java
+
10
−
6
View file @
518cbccb
...
@@ -6,18 +6,20 @@ import junit.framework.TestCase;
...
@@ -6,18 +6,20 @@ import junit.framework.TestCase;
public
class
BattleTest
extends
TestCase
{
public
class
BattleTest
extends
TestCase
{
public
void
testInitiatingBattleWorks
()
{
public
void
testInitiatingBattleWorks
()
{
Army
army1
=
new
Army
(
"Test1"
);
Unit
superBoss
=
new
Unit
(
"SuperBoss"
,
10
,
10
,
10000
)
{
Unit
superBoss
=
new
Unit
(
"SuperBoss"
,
10
,
10
,
10000
)
{
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
100
;
}
public
int
getResistBonus
()
{
return
100
;
}
};
};
army1
.
add
(
superBoss
);
Army
army2
=
new
Army
(
"Test2"
);
Unit
weakling
=
new
Unit
(
"Weakling"
,
1
,
1
,
10
)
{
Unit
weakling
=
new
Unit
(
"Weakling"
,
1
,
1
,
10
)
{
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
0
;
}
};
};
Army
army1
=
new
Army
(
"Test1"
);
army1
.
add
(
superBoss
);
Army
army2
=
new
Army
(
"Test2"
);
army2
.
add
(
weakling
);
army2
.
add
(
weakling
);
try
{
try
{
...
@@ -29,18 +31,20 @@ public class BattleTest extends TestCase {
...
@@ -29,18 +31,20 @@ public class BattleTest extends TestCase {
public
void
testSimulateEndsWithCorrectWinner
()
{
public
void
testSimulateEndsWithCorrectWinner
()
{
Army
army1
=
new
Army
(
"Test1"
);
Unit
superBoss
=
new
Unit
(
"SuperBoss"
,
10
,
10
,
10000
)
{
Unit
superBoss
=
new
Unit
(
"SuperBoss"
,
10
,
10
,
10000
)
{
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
100
;
}
public
int
getResistBonus
()
{
return
100
;
}
};
};
army1
.
add
(
superBoss
);
Army
army2
=
new
Army
(
"Test2"
);
Unit
weakling
=
new
Unit
(
"Weakling"
,
1
,
1
,
10
)
{
Unit
weakling
=
new
Unit
(
"Weakling"
,
1
,
1
,
10
)
{
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getAttackBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
0
;
}
public
int
getResistBonus
()
{
return
0
;
}
};
};
Army
army1
=
new
Army
(
"Test1"
);
army1
.
add
(
superBoss
);
Army
army2
=
new
Army
(
"Test2"
);
army2
.
add
(
weakling
);
army2
.
add
(
weakling
);
Battle
battle
=
new
Battle
(
army1
,
army2
);
Battle
battle
=
new
Battle
(
army1
,
army2
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment