Commit 6eca99c9 authored by Jim Newton's avatar Jim Newton

relaxed test

parent 8b43bdc0
#!/bin/csh -f #!/bin/csh -f
alias STDERR 'bash -c "cat - 1>&2"' alias STDERR 'bash -c "cat - 1>&2"'
cd ~/Repos/scalain-e-student
if (! -d .git/) then if (! -d .git/) then
echo must run in top level dir of git repo | STDERR echo must run in top level dir of git repo | STDERR
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import homework.BinarySearch._ import homework.BinarySearch._
import lecture.BinarySearch._ //import lecture.BinarySearch._
import org.scalatest.FunSuite import org.scalatest.FunSuite
import scala.math._ import scala.math._
...@@ -39,27 +39,6 @@ class BinarySearchTestSuite extends FunSuite { ...@@ -39,27 +39,6 @@ class BinarySearchTestSuite extends FunSuite {
assert(!almostEqual(0.01)(0.001, 0.101)) assert(!almostEqual(0.01)(0.001, 0.101))
} }
test("bin search") {
assert(None != binSearch(-1.5, 1.0, sin, 0.0001, 20))
assert(None != binSearch(-1.0, 1.0, sin, 0.000001, 30))
// given function does not equal 0.0 in the given interval
assert(None == binSearch(1.0, 2.0, (x: Double) => 3.0, 0.001, 20))
assert(None != binSearch(-1.0, 1.0, sin, 0.1, 0.0001, 20))
// interval reversed
assert(None != binSearch(1.0, -1.0, sin, 0.1, 0.0001, 20))
// given function does not equal 20.3 in the given interval
assert(None == binSearch(1.0, -1.0, sin, 20.3, 0.001, 20))
// not enough iterations allowed
assert(None == binSearch(-0.9, 0.72, sin, 0.000001, 2))
}
test("boolean search") { test("boolean search") {
def optionAlmostEqual(test: (Double, Double) => Boolean): (Option[Double], Option[Double]) => Boolean = { def optionAlmostEqual(test: (Double, Double) => Boolean): (Option[Double], Option[Double]) => Boolean = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment