Raymond Toy pushed to branch issue-284-optimize-signed-byte-32-int-len-vop at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • tests/integer.lisp
    1
    +;; Tests of integer functions
    
    2
    +
    
    3
    +(defpackage :integer-tests
    
    4
    +  (:use :cl :lisp-unit))
    
    5
    +
    
    6
    +(in-package "INTEGER-TESTS")
    
    7
    +
    
    8
    +;; Simple functions for testing INTEGER-LENGTH for numbers of type
    
    9
    +;; (unsigned-byte 32) and (signed-byte 32).
    
    10
    +(defun integer-length-u32 (n)
    
    11
    +  (declare (type (unsigned-byte 32) n))
    
    12
    +  (integer-length n))
    
    13
    +
    
    14
    +(defun integer-length-s32 (n)
    
    15
    +  (declare (type (signed-byte 32) n))
    
    16
    +  (integer-length n))
    
    17
    +
    
    18
    +(define-test integer-length.unsigned-byte-32
    
    19
    +    (:tag :issues)
    
    20
    +  (assert-equal 0 (integer-length-u32 0))
    
    21
    +  (assert-equal 1 (integer-length-u32 1))
    
    22
    +  (assert-equal 31 (integer-length-u32 #x70000000))
    
    23
    +  (assert-equal 31 (integer-length-u32 #x7fffffff))
    
    24
    +  (assert-equal 32 (integer-length-u32 #xffffffff)))
    
    25
    +
    
    26
    +(define-test integer-length.signed-byte-32
    
    27
    +    (:tag :issues)
    
    28
    +  (assert-equal 0 (integer-length-s32 0))
    
    29
    +  (assert-equal 1 (integer-length-s32 1))
    
    30
    +  (assert-equal 31 (integer-length-s32 #x70000000))
    
    31
    +  (assert-equal 31 (integer-length-s32 #x7fffffff))
    
    32
    +  (assert-equal 0 (integer-length-s32 -1))
    
    33
    +  (assert-equal 1 (integer-length-s32 -2))
    
    34
    +  (assert-equal 31 (integer-length-s32 #x-70000000))
    
    35
    +  (assert-equal 31 (integer-length-s32 #x-7fffffff))
    
    36
    +  (assert-equal 31 (integer-length-s32 #x-80000000)))
    
    37
    +
    
    38
    +