Improve tests for valid values of iostream bitmask types
authorJonathan Wakely <jwakely@redhat.com>
Wed, 25 Nov 2015 13:49:06 +0000 (13:49 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 25 Nov 2015 13:49:06 +0000 (13:49 +0000)
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Explicitly
check minimum and maximum values, and size of underlying type.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.

From-SVN: r230868

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc

index 2236cfb86c02ac810e4ba37330744016d85108e0..58a196f174c3c1fa02a44fcba34162ec9d39563f 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-25  Jonathan Wakely  <jwakely@redhat.com>
+
+       * testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Explicitly
+       check minimum and maximum values, and size of underlying type.
+       * testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
+       * testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
+
 2015-11-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * acinclude.m4 (GLIBCXX_ENABLE_VTABLE_VERIFY) <solaris2*>: Use
index e8820c5e84a9cf00795cc56e328f0248669cc307..3475fd333a4b2cca19ed0dced9ad00102f89fe06 100644 (file)
@@ -70,9 +70,11 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_fmtflags_end:
       break;
-    case std::_S_ios_fmtflags_min:
+    case __INT_MAX__:
       break;
-    case std::_S_ios_fmtflags_max:
+    case ~__INT_MAX__:
       break;
     }
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+      "underlying type has same range of values as int");
 }
index 4e4e4f5e6234e4697d06ddb0e9984d22d109fbcf..a72a7748ce2b3d999efac9ce1c76e2175987649a 100644 (file)
@@ -42,9 +42,11 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_iostate_end:
       break;
-    case std::_S_ios_iostate_min:
+    case __INT_MAX__:
       break;
-    case std::_S_ios_iostate_max:
+    case ~__INT_MAX__:
       break;
     }
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+      "underlying type has same range of values as int");
 }
index 8c6672f65cec332f007444de9ee6337af5d99431..f621d213a2ae8133cdedcc8544418b5968a483d4 100644 (file)
@@ -46,9 +46,11 @@ case_labels(bitmask_type b)
       break;
     case std::_S_ios_openmode_end:
       break;
-    case std::_S_ios_openmode_min:
+    case __INT_MAX__:
       break;
-    case std::_S_ios_openmode_max:
+    case ~__INT_MAX__:
       break;
     }
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+      "underlying type has same range of values as int");
 }