Ignore:
Timestamp:
08/30/20 06:20:43 (2 months ago)
Author:
Kon Lovett
Message:

fix integer->list type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/bitwise-utils/trunk/tests/srfi-60-test.scm

    r38600 r38928  
    33
    44(import (srfi 60))
    5 
    65(import (srfi 1))
    76
    8 (test-group
    9  "srfi-60"
    10  (test
    11   "logand/bitwise-and"
     7(test-group "srfi-60"
     8 (test "logand/bitwise-and"
    129  "1000"
    1310  (number->string (logand #b1100 #b1010) 2))
    14  (test
    15   "logior/bitwise-ior"
     11 (test "logior/bitwise-ior"
    1612  "1110"
    1713  (number->string (logior #b1100 #b1010) 2))
    18  (test
    19   "logxor/bitwise-xor"
     14 (test "logxor/bitwise-xor"
    2015  "110"
    2116  (number->string (logxor #b1100 #b1010) 2))
    22  (test
    23   "lognot/bitwise-not"
     17 (test "lognot/bitwise-not"
    2418  "-10000001"
    2519  (number->string (lognot #b10000000) 2))
    26  (test
    27   "logtest/any-bit-set? no"
     20 (test "logtest/any-bit-set? no"
    2821  #f
    2922  (logtest #b0100 #b1011))
    30  (test-assert
    31   "logtest/any-bit-set? yes"
     23 (test-assert "logtest/any-bit-set? yes"
    3224  (logtest #b0100 #b0111))
    33  (test
    34   "logcount"
     25 (test "logcount"
    3526  4
    3627  (logcount #b10101010))
    37  (test
    38   "logcount zero"
     28 (test "logcount zero"
    3929  0
    4030  (logcount 0))
    41  (test
    42   "logcount negative"
     31 (test "logcount negative"
    4332  1
    4433  (logcount -2))
    45  (test
    46   "integer-length"
     34 (test "integer-length"
    4735  8
    4836  (integer-length #b10101010))
    49  (test
    50   "integer-length zero"
     37 (test "integer-length zero"
    5138  0
    5239  (integer-length 0))
    53  (test
    54   "integer-length four"
     40 (test "integer-length four"
    5541  4
    5642  (integer-length #b1111))
    57  (test
    58   "log2-binary-factors/first-set-bit"
     43 (test "log2-binary-factors/first-set-bit"
    5944  '(4 0 1 0 2 0 1 0 3 0 1 0 2 0 1 0 -1
    6045      0 1 0 2 0 1 0 3 0 1 0 2 0 1 0 4)
    6146  (map log2-binary-factors (iota 33 -16)))
    62  (test
    63   "logbit?/bit-set?"
     47 (test "logbit?/bit-set?"
    6448  '(#t #f #t #t #f)
    6549  (map (lambda (n) (logbit? n #b1101)) (iota 5)))
    66  (test
    67   "copy-bit zero unary"
     50 (test "copy-bit zero unary"
    6851  "1"
    6952  (number->string (copy-bit 0 0 #t) 2))
    70  (test
    71   "copy-bit zero centenial"
     53 (test "copy-bit zero centenial"
    7254  "100"
    7355  (number->string (copy-bit 2 0 #t) 2))
    74  (test
    75   "copy-bit negative"
     56 (test "copy-bit negative"
    7657  "1011"
    7758  (number->string (copy-bit 2 #b1111 #f) 2))
    78  (test
    79   "bit-field first half"
     59 (test "bit-field first half"
    8060  "1010"
    8161  (number->string (bit-field #b1101101010 0 4) 2))
    82  (test
    83   "bit-field second half"
     62 (test "bit-field second half"
    8463  "10110"
    8564  (number->string (bit-field #b1101101010 4 9) 2))
    86  (test
    87   "copy-bit-field positive"
     65 (test "copy-bit-field positive"
    8866  "1101100000"
    8967  (number->string (copy-bit-field #b1101101010 0 0 4) 2))
    90  (test
    91   "copy-bit-field negative"
     68 (test "copy-bit-field negative"
    9269  "1101101111"
    9370  (number->string (copy-bit-field #b1101101010 -1 0 4) 2))
    94  (test
    95   "copy-bit-field long negative"
     71 (test "copy-bit-field long negative"
    9672  "110100111110000"
    9773  (number->string (copy-bit-field #b110100100010000 -1 5 9) 2))
    98  (test
    99   "ash/arithmetic-shift positive"
     74 (test "ash/arithmetic-shift positive"
    10075  "1000"
    10176  (number->string (ash #b1 3) 2))
    102  (test
    103   "ash/arithmetic-shift negative"
     77 (test "ash/arithmetic-shift negative"
    10478  "101"
    10579  (number->string (ash #b1010 -1) 2))
    106  (test
    107   "rotate-bit-field short positive"
     80 (test "rotate-bit-field short positive"
    10881  "10"
    10982  (number->string (rotate-bit-field #b0100 3 0 4) 2))
    110  (test
    111   "rotate-bit-field short negative"
     83 (test "rotate-bit-field short negative"
    11284  "10"
    11385  (number->string (rotate-bit-field #b0100 -1 0 4) 2))
    114  (test
    115   "rotate-bit-field long negative"
     86 (test "rotate-bit-field long negative"
    11687  "110100010010000"
    11788  (number->string (rotate-bit-field #b110100100010000 -1 5 9) 2))
    118  (test
    119   "rotate-bit-field long positive"
     89 (test "rotate-bit-field long positive"
    12090  "110100000110000"
    12191  (number->string (rotate-bit-field #b110100100010000 1 5 9) 2))
    122  (test
    123   "reverse-bit-field"
     92 (test "reverse-bit-field"
    12493  "e5"
    125   (number->string (reverse-bit-field #xa7 0 8) 16)))
    126 
     94  (number->string (reverse-bit-field #xa7 0 8) 16)) )
Note: See TracChangeset for help on using the changeset viewer.