changeset 20870:020b71557b12

2015 Code Sprint: add BIST tests to bitfcns.cc * bitfcns.cc (Fbitand, Fbitor): Mark as tested with bitxor BIST tests. (Fflintmax, Fintmax, Fintmin, Fsizemax): Add BIST tests.
author Mike Miller <mtmiller@octave.org>
date Sat, 12 Dec 2015 12:59:46 -0500
parents 69b37757030c
children 1e4edab2d22f
files libinterp/corefcn/bitfcns.cc
diffstat 1 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/bitfcns.cc	Sat Dec 12 09:55:20 2015 -0800
+++ b/libinterp/corefcn/bitfcns.cc	Sat Dec 12 12:59:46 2015 -0500
@@ -371,6 +371,10 @@
   return bitop ("bitand", args);
 }
 
+/*
+%!# Function bitand is tested as part of bitxor BIST tests
+*/
+
 DEFUN (bitor, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} bitor (@var{x}, @var{y})\n\
@@ -382,6 +386,10 @@
   return bitop ("bitor", args);
 }
 
+/*
+%!# Function bitor is tested as part of bitxor BIST tests
+*/
+
 DEFUN (bitxor, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} bitxor (@var{x}, @var{y})\n\
@@ -693,6 +701,17 @@
   return retval;
 }
 
+/*
+%!assert (flintmax (), 2^53)
+%!assert (flintmax ("double"), 2^53)
+%!assert (flintmax ("single"), single (2^24))
+
+%!error flintmax (0)
+%!error flintmax ("double", 0)
+%!error flintmax ("int32")
+%!error flintmax ("char")
+*/
+
 DEFUN (intmax, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} intmax (@var{type})\n\
@@ -764,6 +783,23 @@
   return retval;
 }
 
+/*
+%!assert (intmax (),          int32 (2^31 - 1))
+%!assert (intmax ("int8"),     int8 (2^7 - 1))
+%!assert (intmax ("uint8"),   uint8 (2^8 - 1))
+%!assert (intmax ("int16"),   int16 (2^15 - 1))
+%!assert (intmax ("uint16"), uint16 (2^16 - 1))
+%!assert (intmax ("int32"),   int32 (2^31 - 1))
+%!assert (intmax ("uint32"), uint32 (2^32 - 1))
+%!assert (intmax ("int64"),   int64 (2^63 - 1))
+%!assert (intmax ("uint64"), uint64 (2^64 - 1))
+
+%!error intmax (0)
+%!error intmax ("int32", 0)
+%!error intmax ("double")
+%!error intmax ("char")
+*/
+
 DEFUN (intmin, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} intmin (@var{type})\n\
@@ -835,6 +871,23 @@
   return retval;
 }
 
+/*
+%!assert (intmin (),          int32 (-2^31))
+%!assert (intmin ("int8"),     int8 (-2^7))
+%!assert (intmin ("uint8"),   uint8 (-2^8))
+%!assert (intmin ("int16"),   int16 (-2^15))
+%!assert (intmin ("uint16"), uint16 (-2^16))
+%!assert (intmin ("int32"),   int32 (-2^31))
+%!assert (intmin ("uint32"), uint32 (-2^32))
+%!assert (intmin ("int64"),   int64 (-2^63))
+%!assert (intmin ("uint64"), uint64 (-2^64))
+
+%!error intmin (0)
+%!error intmin ("int32", 0)
+%!error intmin ("double")
+%!error intmin ("char")
+*/
+
 DEFUN (sizemax, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {} {} sizemax ()\n\
@@ -852,3 +905,9 @@
 
   return octave_value (octave_int<octave_idx_type> (dim_vector::dim_max ()));
 }
+
+/*
+%!assert (sizemax () >= (intmax ("int32") - 1))
+
+%!error sizemax (0)
+*/