mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-24 05:21:20 -08:00
tests: add some basic tests for ieee-fp
This commit is contained in:
parent
9874b6e53a
commit
0fbf2a4c44
3 changed files with 53 additions and 2 deletions
|
|
@ -21,7 +21,8 @@
|
|||
(:module features
|
||||
:default-component-class asdf:cl-source-file.lsp
|
||||
:components
|
||||
((:file "external-formats" :if-feature :unicode)))))
|
||||
((:file "external-formats" :if-feature :unicode)
|
||||
(:file "ieee-fp" :if-feature :ieee-floating-point)))))
|
||||
|
||||
(asdf:defsystem #:ecl-tests/stress
|
||||
:serial t
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
(suite 'make-check
|
||||
'(features/eformat
|
||||
features/ieee-fp
|
||||
regressions/ansi+
|
||||
regressions/mixed
|
||||
regressions/cmp
|
||||
|
|
@ -45,7 +46,8 @@
|
|||
regressions/mp))
|
||||
|
||||
(suite 'features
|
||||
'(features/eformat))
|
||||
'(features/eformat
|
||||
features/ieee-fp))
|
||||
|
||||
|
||||
;;; Some syntactic sugar for 2am
|
||||
|
|
|
|||
48
src/tests/features/ieee-fp.lsp
Normal file
48
src/tests/features/ieee-fp.lsp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
;;;; -*- Mode: Lisp; Syntax: Common-Lisp; indent-tabs-mode: nil -*-
|
||||
;;;; vim: set filetype=lisp tabstop=8 shiftwidth=2 expandtab:
|
||||
|
||||
;;;; Author: Daniel Kochmański
|
||||
;;;; Created: 2016-08-12
|
||||
;;;; Contains: IEEE floating point tests
|
||||
;;;;
|
||||
|
||||
(in-package :cl-test)
|
||||
|
||||
(suite 'features/ieee-fp)
|
||||
|
||||
(test ieee-fp.0001.infinity-eql
|
||||
(let ((sfni ext:single-float-negative-infinity)
|
||||
(sfpi ext:single-float-positive-infinity)
|
||||
(dfni ext:double-float-negative-infinity)
|
||||
(dfpi ext:double-float-positive-infinity))
|
||||
(is (eql sfni (- sfpi)))
|
||||
(is (eql dfni (- dfpi)))
|
||||
(is (not (eql sfni (- dfpi))))
|
||||
(is (= sfni (- dfpi)))))
|
||||
|
||||
(test ieee-fp.0002.printing
|
||||
(let ((nums (list ext:single-float-negative-infinity
|
||||
ext:single-float-positive-infinity
|
||||
ext:double-float-negative-infinity
|
||||
ext:double-float-positive-infinity
|
||||
(si:nan)
|
||||
(si:infinity)))
|
||||
(*standard-output* (make-string-output-stream)))
|
||||
(dolist (i nums)
|
||||
(finishes
|
||||
(let ((*print-readably* t)
|
||||
(*read-eval* t))
|
||||
(print nums)))
|
||||
(finishes
|
||||
(let ((*print-readably* nil)
|
||||
(*read-eval* nil))
|
||||
(print nums)))
|
||||
(signals print-not-readable
|
||||
(let ((*print-readably* t)
|
||||
(*read-eval* nil))
|
||||
(print nums))))))
|
||||
|
||||
(test ieee-fp.0003.predicates
|
||||
(is (ext:float-infinity-p ext:single-float-negative-infinity))
|
||||
(is (ext:float-infinity-p ext:single-float-positive-infinity))
|
||||
(is (ext:float-nan-p (si:nan))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue