def fail(self, msg=None): self.tests_failed += 1 if not msg: msg = "assertion failed" title = "<b>" + self.getNameFmt("Test failed") + "</b>" writebr(title + msg) return False
def fail(self, msg=None): self.tests_failed+=1 if not msg: msg="assertion failed" title="<b>" + self.getNameFmt("Test failed") + "</b>" writebr(title + msg) return False
def testLoop4(self): t1 = t0 = time.time() n = 100 m = 0.0 while t1 - t0 == 0: m += 1.0 for i in range(n): long_fib(10L) t1 = time.time() dt = t1 - t0 writebr("Loop4 (long): %.2f/sec" % (n*m/dt))
def testLoop3(self): t1 = t0 = time.time() n = 100 m = 0.0 while t1 - t0 == 0: m += 1.0 for i in range(n): int_fib(10) t1 = time.time() dt = t1 - t0 writebr("Loop3 (int): %.2f/sec" % (n*m/dt))
def testLoop4(self): t1 = t0 = time.time() n = 100 m = 0.0 while t1 - t0 == 0: m += 1.0 for i in range(n): long_fib(10L) t1 = time.time() dt = t1 - t0 writebr("Loop4 (long): %.2f/sec" % (n * m / dt))
def testLoop3(self): t1 = t0 = time.time() n = 100 m = 0.0 while t1 - t0 == 0: m += 1.0 for i in range(n): int_fib(10) t1 = time.time() dt = t1 - t0 writebr("Loop3 (int): %.2f/sec" % (n * m / dt))
def fail(self, msg=None): self.tests_failed+=1 if not msg: msg="assertion failed" title="<b>" + self.getNameFmt("Test failed") + "</b>" writebr(title + msg) if console: console.error(msg) console.trace() return False
def testLoop1(self): t1 = t0 = time.time() n = 1000 a = A(1) m = 0; while t1 - t0 == 0: m += 1 for i in range(n): x = a.getX() t1 = time.time() dt = t1 - t0 writebr("Loop1: %.2f/sec" % (n*m/dt))
def testLoop1(self): t1 = t0 = time.time() n = 1000 a = A(1) m = 0 while t1 - t0 == 0: m += 1 for i in range(n): x = a.getX() t1 = time.time() dt = t1 - t0 writebr("Loop1: %.2f/sec" % (n * m / dt))
def fail(self, msg=None): self.startTest() self.tests_failed+=1 if not msg: msg="assertion failed" else: msg = str(msg) title="<b>" + self.getNameFmt("Test failed") + "</b>" writebr(title + msg) if sys.platform in ['mozilla', 'ie6', 'opera', 'oldmoz', 'safari']: from __pyjamas__ import JS JS("""if (typeof @{{!console}} != 'undefined') { if (typeof @{{!console}}.error == 'function') @{{!console}}.error(@{{msg}}); if (typeof @{{!console}}.trace == 'function') @{{!console}}.trace(); }""") return False