Skip to content

Commit

Permalink
Update binary-search to match latest canonical json.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricemery committed Feb 14, 2018
1 parent 373e214 commit ed8f23b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions exercises/binary-search/src/test/scala/BinarySearchTest.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import org.scalatest.{Matchers, FunSuite}

/** @version 1.0.0 */
/** @version 1.1.0 */
class BinarySearchTest extends FunSuite with Matchers {

test("finds a value in an array with one element") {
BinarySearch.find(List(6), 6) should be (Some(0))
}
Expand Down Expand Up @@ -51,4 +51,4 @@ class BinarySearchTest extends FunSuite with Matchers {
pending
BinarySearch.find(List(), 1) should be (None)
}
}
}
8 changes: 3 additions & 5 deletions testgen/src/main/scala/BinarySearchTestGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ object BinarySearchTestGenerator {
}
}

def fromLabeledTest(argNames: String*): ToTestCaseData =
def fromLabeledTestFromInput(argNames: String*): ToTestCaseData =
withLabeledTest { sut =>
labeledTest =>
val args = sutArgs(labeledTest.result, argNames: _*)
val args = sutArgsFromInput(labeledTest.result, argNames: _*)
val property = labeledTest.property
val sutCall =
s"""$sut.$property($args)"""
Expand All @@ -28,11 +28,9 @@ object BinarySearchTestGenerator {

val code =
TestSuiteBuilder.build(file,
fromLabeledTest("array", "value"))
fromLabeledTestFromInput("array", "value"))
println(s"-------------")
println(code)
println(s"-------------")

TestSuiteBuilder.writeToFile(code, new File("AllYourBaseTest.scala"))
}
}

0 comments on commit ed8f23b

Please sign in to comment.