--- numbers.test.~1.17.~ 2003-05-04 09:11:34.000000000 +1000 +++ numbers.test 2003-05-04 09:41:02.000000000 +1000 @@ -1739,3 +1739,32 @@ ;;; ;;; inexact->exact ;;; + +;;; +;;; integer-length +;;; + +(with-test-prefix "integer-length" + + (with-test-prefix "negatives ...11100..00" + (do ((n -1 (ash n 1)) + (i 0 (1+ i))) + ((> i 256)) + (pass-if (list n "expect" i) + (= i (integer-length n))))) + + (with-test-prefix "negatives ...11100..01" + (do ((n -3 (logxor 3 (ash n 1))) + (i 2 (1+ i))) + ((> i 256)) + (pass-if n + (= i (integer-length n))))) + + (with-test-prefix "negatives ...111011..11" + (do ((n -2 (1+ (ash n 1))) + (i 1 (1+ i))) + ((> i 256)) + (pass-if n + (= i (integer-length n)))))) + +