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.2.1.6 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.5 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.4 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.3 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.2 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.1 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.1.0 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.6 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.5 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.4 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.3 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.2 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.1 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.2.0.0 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.55 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.54 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.53 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.52 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.51 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala
trackler-2.1.0.50 tracks/scala/testgen/src/main/scala/BracketPushTestGenerator.scala