You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
;; Copyright 2019 Edward L. Platt <elplatt@alum.mit.edu>
|
|
|
|
|
|
|
|
#lang racket
|
|
|
|
|
|
|
|
(require rackunit "sylvester.rkt")
|
|
|
|
|
|
|
|
(check-equal? (sylvester 0) 2)
|
|
|
|
(check-equal? (sylvester 1) 3)
|
|
|
|
(check-equal? (sylvester 4) 1807)
|
|
|
|
|
|
|
|
(check-equal? (make-sylvester-radix 0) '())
|
|
|
|
(check-equal? (make-sylvester-radix 1) '(1))
|
|
|
|
(check-equal? (make-sylvester-radix 41) '(1 2 6))
|
|
|
|
|
|
|
|
(check-equal? (sylvester-radix-value '()) 0)
|
|
|
|
(check-equal? (sylvester-radix-value '(1)) 1)
|
|
|
|
(check-equal? (sylvester-radix-value '(1 2 6)) 41)
|
|
|
|
|
|
|
|
(check-equal? (add-sylvester-radix '(0 1 2) '(1 1 2)) '(1 2 4))
|
|
|
|
(check-equal? (add-sylvester-radix '(1) '(1)) '(0 1))
|
|
|
|
|
|
|
|
(check-equal? ((extend-sylvester-radix 4) '()) '(0 0 0 0))
|
|
|
|
(check-equal? ((extend-sylvester-radix 3) '(1 1)) '(1 1 0))
|
|
|
|
(check-equal? ((extend-sylvester-radix 2) '(1 1)) '(1 1))
|
|
|
|
(check-equal? ((extend-sylvester-radix 1) '(1 1)) '(1 1))
|
|
|
|
|
|
|
|
|
|
|
|
|