Skip to content
Snippets Groups Projects
Commit 45d7d180 authored by phenixceleste's avatar phenixceleste
Browse files

test changed as ask in discussion ; type Basic efficiency renamed in Neutral

parent 82b9cec5
No related branches found
No related tags found
1 merge request!5Resolve "Type class"
Pipeline #9674 failed with stage
in 2 minutes and 19 seconds
class Efficiency(val factor: Double)
case object Efficient extends Efficiency(2.0)
case object Basic extends Efficiency(1.0)
case object Neutral extends Efficiency(1.0)
case object NotEfficient extends Efficiency(0.5)
case object Inefficient extends Efficiency(0.0)
......@@ -3,7 +3,7 @@ sealed trait Type(val strong_on: List[Type], val weak_on: List[Type], val ineffi
if strong_on.contains(ptype) then Efficient
else if weak_on.contains(ptype) then NotEfficient
else if inefficient_on.contains(ptype) then Inefficient
else Basic
else Neutral
case object Normal extends Type(List(), List(Rock), List(Ghost))
case object Fight extends Type(List(Normal, Rock, Ice), List(Poison, Flying, Bug, Psychic), List(Ghost))
......
......@@ -3,18 +3,18 @@ import org.scalatest.funsuite.AnyFunSuite
class StackSpec extends AnyFunSuite:
test("Strong type should have increased damage multiplicator") {
assert(Fire.typeEfficiency(Grass).factor == 2.0)
test("Strong type should be efficient") {
assert(Fire.typeEfficiency(Grass) == Efficient)
}
test("Weak type should have decreased damage multiplicator") {
assert(Bug.typeEfficiency(Fight).factor == 0.5)
test("Weak type shouldn't be efficient") {
assert(Bug.typeEfficiency(Fight).factor == NotEfficient)
}
test("Common type should have neutral damage multiplicator") {
assert(Electric.typeEfficiency(Poison).factor == 1.0)
test("Normal type should be neutral") {
assert(Electric.typeEfficiency(Poison) == Neutral)
}
test("Inefficient type should have null damage multiplicator") {
assert(Normal.typeEfficiency(Ghost).factor == 0.0)
test("Inefficient type should be inefficient") {
assert(Normal.typeEfficiency(Ghost) == Inefficient)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment