Skip to content

Instantly share code, notes, and snippets.

@sanjivsahayamrea
Created January 9, 2020 23:14
Show Gist options
  • Save sanjivsahayamrea/309b846e1b1ba6d2666ca694b500ffeb to your computer and use it in GitHub Desktop.
Save sanjivsahayamrea/309b846e1b1ba6d2666ca694b500ffeb to your computer and use it in GitHub Desktop.
import org.specs2.mutable.Specification
import org.specs2.specification.core.Fragments
final class TabulatedSpec extends Specification {
def mult(value1: Int, value2: Int): Int = value1 * value2
"Tabulated functions" should {
val table = Map(
(1, 1) -> 1,
(2, 2) -> 4,
(3, 3) -> 9,
(4, 4) -> 16
)
Fragments.foreach(table.toSeq) {
case ((first, second), expected) =>
s"mult ($first, $second)" ! { mult(first, second) must beEqualTo(expected) } ^ br
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment