Sha256: 804d8b092db6eb1a1a7c3a4eacc163f5da24ca656c939390f64e5db929d325f6
Contents?: true
Size: 1.27 KB
Versions: 215
Compression:
Stored size: 1.27 KB
Contents
import play.api.libs.json.Json import scala.io.Source class BracketPushTestGenerator { implicit val testCaseReader = Json.reads[BracketTestCase] private val filename = "bracket-push.json" private val fileContents = Source.fromFile(filename).getLines.mkString private val json = Json.parse(fileContents) def write { print("import org.scalatest.{FunSuite, Matchers}" + System.lineSeparator()) print(System.lineSeparator()) print("class BracketsTest extends FunSuite with Matchers {" + System.lineSeparator()) writeTestCases() print("}" + System.lineSeparator()) } private def writeTestCases(): Unit = { val testCases = (json \ "cases").get.as[List[BracketTestCase]] testCases.foreach(tc => { print("\ttest(\"" + tc.description + "\") {" + System.lineSeparator()) println("pending") println("Brackets.areBalanced(\"\"\"" + tc.input + "\"\"\") should be (" + tc.expected + ")") print("\t}" + System.lineSeparator()) print(System.lineSeparator()) }) } } case class BracketTestCase(description: String, input: String, expected: Boolean) object BracketPushTestGenerator { def main(args: Array[String]): Unit = { new BracketPushTestGenerator().write } }
Version data entries
215 entries across 215 versions & 1 rubygems