Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #4

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions stickyBlocks.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ object juegoStickyBlock {

//Inicio el menu
menu.iniciar()

//nivelActual.iniciar()
}

method reset(){
Expand Down
101 changes: 101 additions & 0 deletions stickyTest.wtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import wollok.game.*
import stickyBlocks.*
import levels.*
import menuYTeclado.*

describe "Tests StickyBlock (individual)" {

method initialize(){
game.clear()
}

test "El StickyBlock se mueve correctamente." {

const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

personajePrincipal.moveTo(arriba)
assert.equals(game.at(0,1), personajePrincipal.position())
}

test "El StickyBlock no se mueve al colisionar con una pared." {

const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

const pared = new Pared(position = game.at(0,1))
pared.iniciar()

cuerpo.moverCuerpo(arriba)
assert.equals(game.at(0,0), personajePrincipal.position())
}
}
describe "Tests del cuerpo." {

method initialize(){
game.clear()
}

test "Compi se une al cuerpo." {

//Seteo el curpo con un compi y un personaje principal
const compi = new StickyCompi(position = game.at(0,2))
compi.iniciar()

const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

//Muevo el cuerpo, tomo al compi y bajo
cuerpo.moverCuerpo(arriba)
cuerpo.moverCuerpo(abajo)

assert.equals(game.at(0,0), personajePrincipal.position())
assert.equals(game.at(0,1), compi.position())
}

test "El cuerpo se mueve correctamente." {

//Seteo el cuerpo con un compi y un personaje principal
const compi = new StickyCompi(position = game.at(0,1))
compi.iniciar()
compi.setAsCuerpo()

const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

//Muevo el cuerpo
cuerpo.moverCuerpo(arriba)

assert.equals(game.at(0,1), personajePrincipal.position())
assert.equals(game.at(0,2), compi.position())
}

test "El cuerpo no se mueve si algun compi colisiona con una pared." {

//Seteo el cuerpo con un compi y un personaje principal
const compi = new StickyCompi(position = game.at(1,0))
compi.iniciar()
compi.setAsCuerpo()

const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

//Seteo una pared que colisionara con el cuerpo
new Pared(position = game.at(0,1)).iniciar()

cuerpo.moverCuerpo(arriba)
assert.equals(game.at(0,0), personajePrincipal.position())
assert.equals(game.at(1,0), compi.position())
}

test "Se revierten el movimiento del cuerpo al ejecutar unDo." {
const personajePrincipal = new PersonajeInicial(position = game.at(0,0))
personajePrincipal.iniciar()

cuerpo.moverCuerpo(arriba)

juegoStickyBlock.unDo()

assert.equals(game.at(0,0), personajePrincipal.position())
}
}