ref: ea42b63a646f61a0ff711fbc5f7663cdd15b4d4c
dir: /tests/integer.zuo/
#lang zuo (require "harness.zuo") (alert "predicate") (check (integer? 10)) (check (not (integer? 'a))) (check (not (integer? '(1 . 2)))) (alert "arithmetic") (check (+ 1 2) 3) (check (+ 1 -2) -1) (check (+ 1 2 3 4) 10) (check (+) 0) (check (+ 1) 1) (check (+ 4294967296 1) 4294967297) (check (+ -4294967296 1) -4294967295) (check (+ 4294967296 1) 4294967297) (check (+ -9223372036854775808 1) -9223372036854775807) (check (- -9223372036854775808 1) 9223372036854775807) (check (+ 9223372036854775807 1) -9223372036854775808) (check-arg-fail (+ 1 'apple) not-integer) (check (- 2 1) 1) (check (- 2 -1) 3) (check (- 1 2 3 4) -8) (check (- 1) -1) (check (- 0) 0) (check (- -9223372036854775808) -9223372036854775808) (check (- -9223372036854775807) 9223372036854775807) (check-arg-fail (-) arity) (check-arg-fail (- 1 'apple) not-integer) (check (* 10 2) 20) (check (* 10 -2) -20) (check (* 1 2 3 4) 24) (check (*) 1) (check (* 10) 10) (check (* 10 0) 0) (check (* 4294967296 4294967296) 0) (check (* 4294967296 -4294967296) 0) (check (* 4294967296 4294967297) 4294967296) (check (* 4294967296 -4294967297) -4294967296) (check (* 2147483648 4294967296) -9223372036854775808) (check (* -9223372036854775808 1) -9223372036854775808) (check (* -9223372036854775808 -1) -9223372036854775808) (check (* 9223372036854775807 -1) -9223372036854775807) (check (* -9223372036854775807 -1) 9223372036854775807) (check-arg-fail (* 1 'apple) not-integer) (check (quotient 5 2) 2) (check (quotient 1 2) 0) (check (quotient -5 2) -2) (check (quotient 5 -2) -2) (check (quotient -9223372036854775808 4294967296) -2147483648) (check (quotient -9223372036854775808 1) -9223372036854775808) (check (quotient -9223372036854775808 -1) -9223372036854775808) (check (quotient 9223372036854775807 -1) -9223372036854775807) (check (quotient -9223372036854775807 -1) 9223372036854775807) (check-arg-fail (quotient -5) arity) (check-arg-fail (quotient 5 'apple) not-integer) (check-arg-fail (quotient 5 0) "divide by zero") (check (modulo 5 2) 1) (check (modulo 2 2) 0) (check (modulo -5 2) -1) (check (modulo 5 -2) 1) (check (modulo -9223372036854775808 1) 0) (check (modulo -9223372036854775808 -1) 0) (check (modulo 9223372036854775807 -1) 0) (check (modulo -9223372036854775807 -1) 0) (check (modulo -9223372036854775808 9223372036854775807) -1) (check (modulo 9223372036854775807 -9223372036854775808) 9223372036854775807) (check-arg-fail (modulo -5) arity) (check-arg-fail (modulo 5 'apple) not-integer) (check-arg-fail (modulo 5 0) "divide by zero") (alert "ordering") (check (= 1 1)) (check (= -9223372036854775808 -9223372036854775808)) (check (<= 1 1)) (check (<= 1 2)) (check (<= -2 -1)) (check (not (<= -1 -2))) (check (<= -9223372036854775808 -9223372036854775808)) (check (<= -9223372036854775808 9223372036854775807)) (check (not (<= 9223372036854775807 -9223372036854775808))) (check-arg-fail (<= 'apple 5) not-integer) (check-arg-fail (<= 5 'apple) not-integer) (check (not (< 1 1))) (check (< 1 2)) (check (< -2 -1)) (check (not (< -1 -2))) (check (not (< -9223372036854775808 -9223372036854775808))) (check (< -9223372036854775808 9223372036854775807)) (check (not (< 9223372036854775807 -9223372036854775808))) (check-arg-fail (< 'apple 5) not-integer) (check-arg-fail (< 5 'apple) not-integer) (check (not (> 1 1))) (check (> 2 1)) (check (> -1 -2)) (check (not (> -2 -1))) (check (not (> -9223372036854775808 -9223372036854775808))) (check (> 9223372036854775807 -9223372036854775808)) (check (not (> -9223372036854775808 9223372036854775807))) (check-arg-fail (> 'apple 5) not-integer) (check-arg-fail (> 5 'apple) not-integer) (check (>= 1 1)) (check (>= 2 1)) (check (>= -1 -2)) (check (not (>= -2 -1))) (check (>= -9223372036854775808 -9223372036854775808)) (check (>= 9223372036854775807 -9223372036854775808)) (check (not (>= -9223372036854775808 9223372036854775807))) (check-arg-fail (>= 'apple 5) not-integer) (check-arg-fail (>= 5 'apple) not-integer) (alert "bitwise") (check 1 (bitwise-and 3 1)) (check 0 (bitwise-and 2 1)) (check 42 (bitwise-and -1 42)) (check -42 (bitwise-and -1 -42)) (check 0 (bitwise-and -1 0)) (check 0 (bitwise-and -9223372036854775808 9223372036854775807)) (check-arg-fail (bitwise-and 'apple 5) not-integer) (check-arg-fail (bitwise-and 5 'apple) not-integer) (check 3 (bitwise-ior 3 1)) (check 3 (bitwise-ior 2 1)) (check -1 (bitwise-ior -1 42)) (check 42 (bitwise-ior 0 42)) (check -42 (bitwise-ior 0 -42)) (check -1 (bitwise-ior -9223372036854775808 9223372036854775807)) (check-arg-fail (bitwise-ior 'apple 5) not-integer) (check-arg-fail (bitwise-ior 5 'apple) not-integer) (check 2 (bitwise-xor 3 1)) (check 3 (bitwise-xor 2 1)) (check -43 (bitwise-xor -1 42)) (check 42 (bitwise-xor 0 42)) (check -42 (bitwise-xor 0 -42)) (check -1 (bitwise-xor -9223372036854775808 9223372036854775807)) (check-arg-fail (bitwise-xor 'apple 5) not-integer) (check-arg-fail (bitwise-xor 5 'apple) not-integer) (check -1 (bitwise-not 0)) (check 0 (bitwise-not -1)) (check 41 (bitwise-not -42)) (check -43 (bitwise-not 42)) (check 9223372036854775807 (bitwise-not -9223372036854775808)) (check-arg-fail (bitwise-not 'apple) not-integer)