From 63b62751fc1ba688e0e02fbb55cd73007d04c990 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 13 Jun 2022 21:49:51 -0400 Subject: [PATCH] WIP, testing str->bignum2 --- test-bn.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test-bn.scm b/test-bn.scm index 8aa85758..53828522 100644 --- a/test-bn.scm +++ b/test-bn.scm @@ -13,6 +13,14 @@ ; return_closcall1(data, k, bn); ; ") + (define-c test-str2bn + "(void *data, int argc, closure _, object k, object str, object radix)" + " int len = string_len(str); + char *s = string_str(str); + bignum2_type *bn = gc_alloc_bignum2(data, len); + bn = str_to_bignum(data, bn, s, s + len, obj_obj2int(radix)); + return_closcall1(data, k, bn); ") + (define-c test-plus "(void *data, int argc, closure _, object k, object fx1, object fx2)" " object bn1 = Cyc_int2bignum2(data, obj_obj2int(fx1)); @@ -44,6 +52,12 @@ if(is_value_type(result)) { (write (test-bn 123456789)) (newline) +(write (test-str2bn "123454354534523454243999" 10)) +(newline) + +(write (test-str2bn "123454354534523454243999" 16)) +(newline) + (map (lambda (row) (write row)