basis: Add unit-test~ and unit-test-v~ for testing floats.
Use unit-test~ in math.functions in some places to make sure we like it.modern-harvey2
parent
9adddfc5e5
commit
62129ffea4
|
@ -82,11 +82,11 @@ CONSTANT: log10-factorial-1000 0x1.40f3593ed6f8ep11
|
|||
{ 4.0 } [ 10000.0 log10 ] unit-test
|
||||
{ $ log10-factorial-1000 t } [ 1000 factorial [ log10 ] [ bignum? ] bi ] unit-test
|
||||
|
||||
{ t } [ 1 e^ e 1.e-10 ~ ] unit-test
|
||||
{ f } [ 1 e^ 0/0. 1.e-10 ~ ] unit-test
|
||||
{ f } [ 0/0. 1 e^ 1.e-10 ~ ] unit-test
|
||||
{ t } [ 1.0 e^ e 1.e-10 ~ ] unit-test
|
||||
{ t } [ -1 e^ e * 1.0 1.e-10 ~ ] unit-test
|
||||
{ e 1.e-10 } [ 1 e^ ] unit-test~
|
||||
{ 0/0. 1.e-10 } [ 1 e^ ] unit-test~
|
||||
{ 1.e-10 } [ 0/0. 1 e^ ] unit-test~
|
||||
{ e 1.e-10 } [ 1.0 e^ ] unit-test~
|
||||
{ 1.0 1.e-10 } [ -1 e^ e * ] unit-test~
|
||||
{ f } [ 1/0. 1/0. 1.e-10 ~ ] unit-test
|
||||
{ f } [ 1/0. -1/0. 1.e-10 ~ ] unit-test
|
||||
{ f } [ 1/0. 0/0. 1.e-10 ~ ] unit-test
|
||||
|
@ -120,12 +120,13 @@ CONSTANT: log10-factorial-1000 0x1.40f3593ed6f8ep11
|
|||
{ f } [ 10 atanh real? ] unit-test
|
||||
{ f } [ 10.0 atanh real? ] unit-test
|
||||
|
||||
{ t } [ 10 asin sin 10 1.e-10 ~ ] unit-test
|
||||
{ 10 1.e-10 } [ 10 asin sin ] unit-test~
|
||||
{ -100 1.e-10 } [ -100 atan tan ] unit-test~
|
||||
{ 10 1.e-10 } [ 10 asinh sinh ] unit-test~
|
||||
{ 10 1.e-10 } [ 10 atanh tanh ] unit-test~
|
||||
{ 0.5 1.e-10 } [ 0.5 atanh tanh ] unit-test~
|
||||
|
||||
{ t } [ -1 sqrt neg dup acos cos 1.e-10 ~ ] unit-test
|
||||
{ t } [ -100 atan tan -100 1.e-10 ~ ] unit-test
|
||||
{ t } [ 10 asinh sinh 10 1.e-10 ~ ] unit-test
|
||||
{ t } [ 10 atanh tanh 10 1.e-10 ~ ] unit-test
|
||||
{ t } [ 0.5 atanh tanh 0.5 1.e-10 ~ ] unit-test
|
||||
|
||||
{ t } [ 0 42 divisor? ] unit-test
|
||||
{ t } [ 42 7 divisor? ] unit-test
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2004, 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: math kernel math.constants math.private math.bits
|
||||
math.libm combinators fry math.order sequences ;
|
||||
USING: combinators fry kernel math math.bits math.constants
|
||||
math.libm math.order math.private sequences ;
|
||||
IN: math.functions
|
||||
|
||||
GENERIC: sqrt ( x -- y ) foldable
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
USING: accessors arrays assocs combinators command-line
|
||||
compiler.units continuations debugger effects fry
|
||||
generalizations io io.files.temp io.files.unique kernel lexer
|
||||
locals macros namespaces parser prettyprint quotations sequences
|
||||
sequences.generalizations source-files source-files.errors
|
||||
source-files.errors.debugger splitting stack-checker summary
|
||||
system tools.errors unicode vocabs vocabs.files vocabs.metadata
|
||||
vocabs.parser words ;
|
||||
locals macros math.functions math.vectors namespaces parser
|
||||
prettyprint quotations sequences sequences.generalizations
|
||||
source-files source-files.errors source-files.errors.debugger
|
||||
splitting stack-checker summary system tools.errors unicode
|
||||
vocabs vocabs.files vocabs.metadata vocabs.parser words ;
|
||||
FROM: vocabs.hierarchy => load ;
|
||||
IN: tools.test
|
||||
|
||||
|
@ -64,6 +64,18 @@ SYMBOL: current-test-file
|
|||
: (long-unit-test) ( output input -- error/f failed? tested? )
|
||||
long-unit-tests-enabled? get [ (unit-test) ] [ 2drop f f f ] if ;
|
||||
|
||||
: (unit-test-comparator) ( output input comparator -- error/f failed? tested? )
|
||||
swapd '[
|
||||
{ } _ with-datastack
|
||||
_ >quotation _ compose with-datastack f
|
||||
] [ t ] recover t ; inline
|
||||
|
||||
: (unit-test~) ( output input -- error/f failed? tested? )
|
||||
[ ~ ] (unit-test-comparator) ;
|
||||
|
||||
: (unit-test-v~) ( output input -- error/f failed? tested? )
|
||||
[ v~ ] (unit-test-comparator) ;
|
||||
|
||||
: short-effect ( effect -- pair )
|
||||
[ in>> length ] [ out>> length ] bi 2array ;
|
||||
|
||||
|
@ -172,6 +184,9 @@ PRIVATE>
|
|||
[ cleanup-unique-directory ] with-temp-directory ; inline
|
||||
|
||||
TEST: unit-test
|
||||
TEST: unit-test~
|
||||
TEST: unit-test-v~
|
||||
TEST: unit-test-comparator
|
||||
TEST: long-unit-test
|
||||
TEST: must-infer-as
|
||||
TEST: must-infer
|
||||
|
|
Loading…
Reference in New Issue