view chapter9/MyAssertion.scala @ 0:b316eec6fa7a draft default tip

add sample files
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 08 Jan 2013 16:41:46 +0900
parents
children
line wrap: on
line source

var assertionsEnabled = true
def myAssert(predicate: () => Boolean) =
    if (assertionsEnabled && !predicate())
	throw new AssertionError

def byNameAssert(predicate: => Boolean) =
    if (assertionsEnabled && !predicate)
	throw new AssertionError