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

Version Path
trackler-2.0.8.3 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.8.2 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.8.1 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.7.0 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.44 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.43 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.42 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.41 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.40 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.39 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.38 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.37 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.36 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.35 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.34 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.33 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.32 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.31 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.30 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.0.6.29 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala