;;;; numbers.test --- test suite for Guile's numerical ops   -*- scheme -*-
;;;; Author: Thien-Thi Nguyen <[EMAIL PROTECTED]>
;;;;
;;;;    Copyright (C) 1999 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING.  If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA

;;;; Commentary:

;;; Both R4RS and R5RS define these 54 numerical operations:
;;;
;;; * + - / < <= = > >= abs acos angle asin atan ceiling complex? cos
;;; denominator even? exact->inexact exact? exp expt floor gcd imag-part
;;; inexact->exact inexact? integer? lcm log magnitude make-polar
;;; make-rectangular max min modulo negative? number? numerator odd?
;;; positive? quotient rational? rationalize real-part real? remainder
;;; round sin sqrt tan truncate zero?
;;;
;;; You should probably put tests for these operations in the appropriate
;;; r?rs.test file.  This file has tests for numerical operations unique
;;; to Guile.

;;;; Code:

(use-modules (test-suite lib))

(pass-if "(ash 2 0) => 2" (= 2 (ash 2 0)))
(pass-if "(ash 2 1) => 4" (= 4 (ash 2 1)))
(pass-if "(ash 2 -1) => 1" (= 1 (ash 2 -1)))

(pass-if "(ash 1 0) => 1" (= 1 (ash 1 0)))
(pass-if "(ash 1 1) => 2" (= 2 (ash 1 1)))
(pass-if "(ash 1 -1) => 0" (= 0 (ash 1 -1)))

(pass-if "(ash 0 0) => 0" (= 0 (ash 0 0)))
(pass-if "(ash 0 1) => 0" (= 0 (ash 0 1)))
(pass-if "(ash 0 -1) => 0" (= 0 (ash 0 -1)))

(pass-if "(ash -1 0) => -1" (= -1 (ash -1 0)))
(pass-if "(ash -1 1) => -2" (= -2 (ash -1 1)))
(pass-if "(ash -1 -1) => -1" (= -1 (ash -1 -1)))

(pass-if "(ash -2 0) => -2" (= -2 (ash -2 0)))
(pass-if "(ash -2 1) => -4" (= -4 (ash -2 1)))
(pass-if "(ash -2 -1) => -1" (= -1 (ash -2 -1)))

;;;; numbers.test ends here

Reply via email to