Skip to content

Commit

Permalink
Algunos tests y cambios en marcilla
Browse files Browse the repository at this point in the history
  • Loading branch information
bcochon committed Oct 17, 2024
1 parent 1b26285 commit 2b1424c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions morcilla.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object morcilla {
var movimientoActivo = true

method saltando() = saltando
method suspendido() = suspendido

method caminarDerecha(pasos) {
if(movimientoActivo)
Expand Down Expand Up @@ -72,6 +73,7 @@ object morcilla {
var property vidas = 5
var inmunidadActiva = false
var property puedeAtacar = false
var derrotado = false

method perderVida() {
vidas = (vidas-1).max(0)
Expand All @@ -89,9 +91,12 @@ object morcilla {
}

method derrota() {
derrotado = true
game.say(self, "Ya perdí :(")
}

method derrotado() = derrotado

method atacar() {
// Acá habría una animación, por ejemplo
}
Expand Down
10 changes: 10 additions & 0 deletions pruebas.wtest
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
import morcilla.*

describe "Tests de morcilla" {

test "La vida de morcilla está entre los valores normales" {
assert.that(morcilla.vidas() > 0 || morcilla.derrotado())
}

test "Morcilla se suspende si está saltando" {
assert.that(!morcilla.suspendido() && !morcilla.saltando()) // Si morcilla no está suspendido, no puede estar saltando
}
}

0 comments on commit 2b1424c

Please sign in to comment.