test: add unit tests for all poker combinations
This commit is contained in:
2
debug.log
Normal file
2
debug.log
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[0418/231810.857:ERROR:crashpad_client_win.cc(811)] not connected
|
||||||
|
[0418/231810.987:ERROR:crashpad_client_win.cc(811)] not connected
|
||||||
25
src/test/scala/combinations/FlushTest.scala
Normal file
25
src/test/scala/combinations/FlushTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class FlushTest extends FunSuite {
|
||||||
|
|
||||||
|
test("Flush reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cinco cartas del mismo palo, sin orden
|
||||||
|
)
|
||||||
|
val combinacion = new Flush()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(35, 4))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("Flush no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new Flush()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/FourOfAKindTest.scala
Normal file
25
src/test/scala/combinations/FourOfAKindTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class FourOfAKindTest extends FunSuite {
|
||||||
|
|
||||||
|
test("FourOfAKind reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cuatro cartas del mismo rango
|
||||||
|
)
|
||||||
|
val combinacion = new FourOfAKind()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(60, 7))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("FourOfAKind no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new FourOfAKind()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/FullHouseTest.scala
Normal file
25
src/test/scala/combinations/FullHouseTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class FullHouseTest extends FunSuite {
|
||||||
|
|
||||||
|
test("FullHouse reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: tres cartas de un rango y dos de otro
|
||||||
|
)
|
||||||
|
val combinacion = new FullHouse()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(40, 4))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("FullHouse no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new FullHouse()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/HighCardTest.scala
Normal file
25
src/test/scala/combinations/HighCardTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class HighCardTest extends FunSuite {
|
||||||
|
|
||||||
|
test("HighCard reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: sin pares, sin color, sin escalera
|
||||||
|
)
|
||||||
|
val combinacion = new HighCard()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(5, 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("HighCard no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new HighCard()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/PairTest.scala
Normal file
25
src/test/scala/combinations/PairTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class PairTest extends FunSuite {
|
||||||
|
|
||||||
|
test("Pair reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: un par
|
||||||
|
)
|
||||||
|
val combinacion = new Pair()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(10, 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("Pair no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new Pair()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/StraightFlushTest.scala
Normal file
25
src/test/scala/combinations/StraightFlushTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class StraightFlushTest extends FunSuite {
|
||||||
|
|
||||||
|
test("StraightFlush reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cinco cartas consecutivas del mismo palo
|
||||||
|
)
|
||||||
|
val combinacion = new StraightFlush()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(100, 8))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("StraightFlush no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new StraightFlush()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/StraightTest.scala
Normal file
25
src/test/scala/combinations/StraightTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class StraightTest extends FunSuite {
|
||||||
|
|
||||||
|
test("Straight reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cinco cartas consecutivas de cualquier palo
|
||||||
|
)
|
||||||
|
val combinacion = new Straight()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(30, 4))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("Straight no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new Straight()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/ThreeOfAKindTest.scala
Normal file
25
src/test/scala/combinations/ThreeOfAKindTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class ThreeOfAKindTest extends FunSuite {
|
||||||
|
|
||||||
|
test("ThreeOfAKind reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: tres cartas del mismo rango
|
||||||
|
)
|
||||||
|
val combinacion = new ThreeOfAKind()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(30, 3))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("ThreeOfAKind no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new ThreeOfAKind()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/test/scala/combinations/TwoPairTest.scala
Normal file
25
src/test/scala/combinations/TwoPairTest.scala
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package combinations
|
||||||
|
|
||||||
|
import munit.FunSuite
|
||||||
|
import cards._
|
||||||
|
import score.Score
|
||||||
|
|
||||||
|
class TwoPairTest extends FunSuite {
|
||||||
|
|
||||||
|
test("TwoPair reconoce una mano válida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: dos pares de distinto rango
|
||||||
|
)
|
||||||
|
val combinacion = new TwoPair()
|
||||||
|
assert(combinacion.verifica(hand))
|
||||||
|
assertEquals(combinacion.score, Score(20, 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
test("TwoPair no reconoce una mano inválida") {
|
||||||
|
val hand = List(
|
||||||
|
// TODO: cartas que no cumplan la condición
|
||||||
|
)
|
||||||
|
val combinacion = new TwoPair()
|
||||||
|
assert(!combinacion.verifica(hand))
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user