mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
WIP
This commit is contained in:
parent
53a37be833
commit
b410f6d667
1 changed files with 95 additions and 77 deletions
172
test-bn.scm
172
test-bn.scm
|
@ -69,83 +69,101 @@ if(is_value_type(result)) {
|
||||||
return_closcall1(data, k, bn);
|
return_closcall1(data, k, bn);
|
||||||
")
|
")
|
||||||
|
|
||||||
(write (test-bn 123456789))
|
(write
|
||||||
|
(test-plus
|
||||||
|
(test-str2bn "1234567890123456789012345678901234567890" 10)
|
||||||
|
(test-str2bn "1234567890" 10))
|
||||||
|
)
|
||||||
(newline)
|
(newline)
|
||||||
|
|
||||||
(write (test-str2bn "123454354534523454243999" 10))
|
;(write (test-bn 123456789))
|
||||||
(newline)
|
;(newline)
|
||||||
|
;
|
||||||
(write (test-str2bn "-123454354534523454243999" 10))
|
;(write (test-str2bn "123454354534523454243999" 10))
|
||||||
(newline)
|
;(newline)
|
||||||
|
;
|
||||||
(write (test-str2bn "123454354534523454243999" 16))
|
;(write (test-str2bn "-123454354534523454243999" 10))
|
||||||
(newline)
|
;(newline)
|
||||||
|
;
|
||||||
(write "subtraction")
|
;(write (test-str2bn "123454354534523454243999" 16))
|
||||||
(newline)
|
;(newline)
|
||||||
(map
|
;
|
||||||
(lambda (row)
|
;(write (test-str2bn "1234567890123456789012345678901234567890" 10))
|
||||||
(write row)
|
;(newline)
|
||||||
(newline))
|
;(write (test-str2bn "1234567890" 10))
|
||||||
(list
|
;(newline)
|
||||||
(test-minus ;; TODO: just hangs, WTF?
|
;
|
||||||
(test-str2bn "1234567890123456789012345678901234567890")
|
;(write "subtraction")
|
||||||
(test-str2bn "1234567890"))
|
;(newline)
|
||||||
(test-minus
|
;(map
|
||||||
(test-str2bn "1234567890")
|
; (lambda (row)
|
||||||
(test-str2bn "1234567890123456789012345678901234567890"))
|
; (write row)
|
||||||
(test-minus 1 1)
|
; (newline))
|
||||||
(test-minus 1 2)
|
; (list
|
||||||
(test-minus -1 2)
|
; (test-minus
|
||||||
(test-minus (- #x0FFFffff) (- #x0FFFffff))
|
; (test-str2bn "1234567890123456789012345678901234567890" 10)
|
||||||
(test-minus (- #x2FFFffff) (- #x2FFFffff))
|
; (test-str2bn "1234567890" 10))
|
||||||
))
|
; (test-minus
|
||||||
(newline)
|
; (test-str2bn "1234567890" 10)
|
||||||
|
; (test-str2bn "1234567890123456789012345678901234567890" 10))
|
||||||
(write "multiplication")
|
; (test-minus 1 1)
|
||||||
(newline)
|
; (test-minus 1 2)
|
||||||
(map
|
; (test-minus -1 2)
|
||||||
(lambda (row)
|
; (test-minus (- #x0FFFffff) (- #x0FFFffff))
|
||||||
(write row)
|
; (test-minus (- #x2FFFffff) (- #x2FFFffff))
|
||||||
(newline))
|
;))
|
||||||
(list
|
;(newline)
|
||||||
(test-times 1 1)
|
;
|
||||||
(test-times 1 2)
|
;(write "multiplication")
|
||||||
(test-times -1 2)
|
;(newline)
|
||||||
(test-times #x0FFFffff #x0FFFffff)
|
;(map
|
||||||
(test-times #x2FFFffff #x2FFFffff)
|
; (lambda (row)
|
||||||
))
|
; (write row)
|
||||||
|
; (newline))
|
||||||
(write "general")
|
; (list
|
||||||
(newline)
|
; (test-times
|
||||||
(map
|
; (test-str2bn "1234567890123456789012345678901234567890" 10)
|
||||||
(lambda (row)
|
; (test-str2bn "1234567890" 10))
|
||||||
(write row)
|
; (test-times 1 1)
|
||||||
(newline))
|
; (test-times 1 2)
|
||||||
(list
|
; (test-times -1 2)
|
||||||
(test-plus #x0FFFffff #x0FFFffff)
|
; (test-times #x0FFFffff #x0FFFffff)
|
||||||
(test-plus #x2FFFffff #x2FFFffff)
|
; (test-times #x2FFFffff #x2FFFffff)
|
||||||
(test-plus 1 2)
|
;))
|
||||||
;; TODO: (fixnum? (test-plus 1 2))
|
;
|
||||||
(test-plus -1 2)
|
;(write "general")
|
||||||
(test-bn 123456789 )
|
;(newline)
|
||||||
(test-bn 123456789 )
|
;(map
|
||||||
(test-larger-bn 0 #x0FFF0001 )
|
; (lambda (row)
|
||||||
(test-bn #x0FFF0001 )
|
; (write row)
|
||||||
|
; (newline))
|
||||||
(test-bn 0 ) ;; TODO: 0 is broken right now!
|
; (list
|
||||||
(test-bn -10 )
|
; (test-plus
|
||||||
(test-bn 163264 )
|
; (test-str2bn "1234567890123456789012345678901234567890" 10)
|
||||||
(test-bn 16326 )
|
; (test-str2bn "1234567890" 10))
|
||||||
(test-bn -16326000 )
|
; (test-plus #x0FFFffff #x0FFFffff)
|
||||||
(number->string (test-bn #x0FFFffff) 10)
|
; (test-plus #x2FFFffff #x2FFFffff)
|
||||||
(number->string (test-bn #x0FFFffff) 16)
|
; (test-plus 1 2)
|
||||||
(number->string (test-bn #x0eadbeef) 16)
|
; ;; TODO: (fixnum? (test-plus 1 2))
|
||||||
(number->string (test-bn #x0eadbeef) 12)
|
; (test-plus -1 2)
|
||||||
(test-bn #x0eadbeef)
|
; (test-bn 123456789 )
|
||||||
(test-bn #x0eadbeef)
|
; (test-bn 123456789 )
|
||||||
(test-bn #x3FFFffff)
|
; (test-larger-bn 0 #x0FFF0001 )
|
||||||
(test-larger-bn #x3FFF0000 #x0FFF0001 )
|
; (test-bn #x0FFF0001 )
|
||||||
))
|
;
|
||||||
(newline)
|
; (test-bn 0 ) ;; TODO: 0 is broken right now!
|
||||||
|
; (test-bn -10 )
|
||||||
|
; (test-bn 163264 )
|
||||||
|
; (test-bn 16326 )
|
||||||
|
; (test-bn -16326000 )
|
||||||
|
; (number->string (test-bn #x0FFFffff) 10)
|
||||||
|
; (number->string (test-bn #x0FFFffff) 16)
|
||||||
|
; (number->string (test-bn #x0eadbeef) 16)
|
||||||
|
; (number->string (test-bn #x0eadbeef) 12)
|
||||||
|
; (test-bn #x0eadbeef)
|
||||||
|
; (test-bn #x0eadbeef)
|
||||||
|
; (test-bn #x3FFFffff)
|
||||||
|
; (test-larger-bn #x3FFF0000 #x0FFF0001 )
|
||||||
|
; ))
|
||||||
|
;(newline)
|
||||||
;(repl)
|
;(repl)
|
||||||
|
|
Loading…
Add table
Reference in a new issue