shithub: mc

Download patch

ref: 964632bdffbee7760477e2faa3c862a18528f518
parent: 72ad21bc126ddcf29780bba789a3fbc7d8d34ff8
author: Ori Bernstein <[email protected]>
date: Wed Jan 22 14:08:22 EST 2014

Add bigint test.

--- /dev/null
+++ b/test/bigint.myr
@@ -1,0 +1,26 @@
+use std
+
+const main = {
+	var a, b, c, d, e
+	var buf : byte[1024], n
+
+	a = std.mkbigint(1234)
+	b = std.mkbigint(0x7fffffff)
+	c = std.mkbigint(7919)
+	d = std.mkbigint(113051)
+	e = std.mkbigint(11)
+
+	std.bigmul(a, b)
+	std.bigmul(a, b)
+	std.bigadd(a, c)
+	std.bigsub(a, d)
+	std.bigdiv(a, e)
+
+	std.bigfree(b)
+	std.bigfree(c)
+	std.bigfree(d)
+	std.bigfree(e)
+
+	n = std.bigfmt(buf[:], a)
+	std.put("%s\n", buf[:n])
+}
--- a/test/tests
+++ b/test/tests
@@ -116,6 +116,7 @@
 B strsplit	C
 B strfind	C
 B strjoin	C
+B bigint	P	517347321949036993306
 # B local-labels	E	10 ## BUGGERED
 F declmismatch
 F infermismatch