Skip to content

Instantly share code, notes, and snippets.

@labra
Created October 15, 2014 01:40
Show Gist options
  • Save labra/170a570f49922fd5281c to your computer and use it in GitHub Desktop.
Save labra/170a570f49922fd5281c to your computer and use it in GitHub Desktop.
Ejercicio Scala figuras - ScalaTest
package es.poo
import org.scalatest._
import Matchers._
class FigurasSpec extends FunSpec with Matchers {
describe("Figuras") {
it("debe crear una figura y calcular su posicion") {
val f = new Figura(2,3)
f.pos should be ((2,3))
}
it("debe crear un rectangulo y calcular su posicion") {
val r = new Rect(2,3,4,5)
r.pos should be ((2,3))
}
it("debe crear un rectangulo y calcular su area") {
val r = new Rect(2,3,4,5)
r.area should be (20)
}
it("debe crear un circulo y calcular su posicion") {
val r = new Circulo(3,1,4)
r.pos should be ((3,1))
}
it("debe crear un circulo y calcular su area") {
val r = new Circulo(3,1,3)
r.area should be (28.27 +- 0.01)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment