Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Created May 1, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/340795c6e2761abd203a7ecd53863543 to your computer and use it in GitHub Desktop.
Save pandanote-info/340795c6e2761abd203a7ecd53863543 to your computer and use it in GitHub Desktop.
複素数を扱うためのScalaクラスに対するScalaTest用のテストファイルの記述例。
package info.pandanote.test
import org.scalatest.Assertions
import org.scalatest._
class ComplexNumberTest extends FlatSpec with Matchers {
"a" should "123" in {
val a = "123"
a should be("123")
}
"a*a" should "-3+4i" in {
val a = ComplexNumber(1,2)
a*a should be(ComplexNumber(-3,4))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment