shithub: mc

Download patch

ref: a23019f08b895626d073258d5d20fa3479d73731
parent: 52ec5d6f05690494ee1a43452a0305ea697f0165
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Oct 25 21:13:12 EDT 2016

Fix benchmark programs.

--- a/bench/intsort.myr
+++ b/bench/intsort.myr
@@ -1,14 +1,11 @@
 use std
 
 const main = {
-	var a
-	var i
-	var rng
+	var a, i
 
-	rng = std.mksrng(123)
 	a = std.slalloc(500_000)
 	for i = 0; i < a.len; i++
-		a[i] = std.rand32(rng)
+		a[i] = std.randnum()
 	;;
 	std.sort(a, std.numcmp)
 }
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -71,7 +71,6 @@
 		freecmd(bin)
 		std.slfree(dir)
 	;;
-	std.slfree(tests)
 	if tests.len == 0
 		-> true
 	;;
@@ -80,16 +79,17 @@
 	for f in failed
 		std.slfree(f)
 	;;
-	std.slfree(failed)
 	if ok
 		std.put("TESTS PASSED\n")
 	else
-		std.put("TESTS FAILED\n")
+		std.put("TESTS FAILED ({}/P{\n")
 	;;
+	std.slfree(failed)
+	std.slfree(tests)
 	-> ok
 }
 
-const printfailed : (f : byte[:][:] -> void) = {failed
+const printfailed = {failed
 	if failed.len > 10
 		std.put("\t{} tests failed\n", failed.len)
 	elif failed.len > 0