Last active
August 29, 2015 14:07
-
-
Save labra/1c2bdf6ec9201ba14d73 to your computer and use it in GitHub Desktop.
Ejercicio Scala corregir exámenes - ScalaTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package es.poo | |
import org.scalatest._ | |
import Matchers._ | |
class CorrectorSpec extends FunSpec with Matchers { | |
describe("Corrector") { | |
val preguntas = Preguntas( | |
items = List(Item(pregunta = 1, correcta = "a"), | |
Item(pregunta = 2, correcta = "b") | |
) | |
) | |
val evaluacion = | |
Evaluacion(entradas = | |
List(Entrada(alumno = 2456, | |
respuestas = | |
List( Respuesta(pregunta = 1, respuesta= "a"), | |
Respuesta(pregunta = 2, respuesta= "b") | |
) | |
), | |
Entrada(alumno = 4321, | |
respuestas = | |
List( Respuesta(pregunta = 1, respuesta= "b"), | |
Respuesta(pregunta = 2, respuesta= "b") | |
) | |
), | |
Entrada(alumno = 6789, | |
respuestas = | |
List( Respuesta(pregunta = 1, respuesta= "b"), | |
Respuesta(pregunta = 2, respuesta= "a") | |
) | |
) | |
) | |
) | |
val resultados = | |
Resultados(resultados = | |
Vector( | |
Resultado(alumno=2456, nota = 2), | |
Resultado(alumno=4321, nota = 0.75), | |
Resultado(alumno=6789, nota = -0.5) | |
) | |
) | |
it ("debe evaluar unas preguntas en una evaluacion") { | |
Corrector.evalua(preguntas,evaluacion) should be(resultados) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment