beark / ftl

C++ template library for fans of functional programming
zlib License
992 stars 69 forks source link

Implement and use fequal to fix false negatative tests. #10

Closed splinterofchaos closed 10 years ago

splinterofchaos commented 10 years ago

Some tests may not pass due to slight differences in floating point numbers. They seem to pass when compiled with gcc on some systems, but not all. It may relate to the gcc version.

$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)

$ ./ftl_tests Running test set 'prelude'...10/10 passed Running test set 'either'...20/20 passed Running test set 'either_trans'...18/18 passed Running test set 'maybe'...29/29 passed Running test set 'maybe_trans'...20/20 passed Running test set 'future'...6/6 passed Running test set 'lazy'...12/12 passed Running test set 'lazy_trans'...6/6 passed Running test set 'ord'...7/7 passed Running test set 'functional'... functor::map: fail functorstd::function::map: fail 9/11 passed Running test set 'list'...24/24 passed Running test set 'vector'...24/24 passed Running test set 'forward_list'...22/22 passed Running test set 'tuple'...5/5 passed Running test set 'memory'...16/16 passed Running test set 'string'...5/5 passed Running test set 'set'... foldable::foldr: fail 9/10 passed Running test set 'map'... foldable::foldr: fail 4/5 passed Running test set 'unordered_map'...3/3 passed Running test set 'concepts'...18/18 passed

This commit changes only the tests that failed. The other tests likely succeed because their calculations can be exactly represented in binary.