Created
October 15, 2014 01:40
-
-
Save labra/170a570f49922fd5281c to your computer and use it in GitHub Desktop.
Ejercicio Scala figuras - 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 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