diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-23 23:49:55 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-23 23:49:55 +0000 |
commit | 2d72cfee8e161d0511516c43bf34664ecf0046d8 (patch) | |
tree | 7c0cb50addaa5f26fbf01e328c2260d02931aa2d /base/safe_numerics_unittest.nc | |
parent | b704789c4be9893476f87212551b7ed85f20df4c (diff) | |
download | chromium_src-2d72cfee8e161d0511516c43bf34664ecf0046d8.zip chromium_src-2d72cfee8e161d0511516c43bf34664ecf0046d8.tar.gz chromium_src-2d72cfee8e161d0511516c43bf34664ecf0046d8.tar.bz2 |
Fix no-compile tests in base.
- Fixed a nocompile test wasn't ever no compiled (probably a side effect
of http://crrev.com/111889) and never worked.
- Updated the error messages to those used by gcc 4.6 in Precise
- Minor improvement to the nocompile driver that makes the compiler
output more friendly when the regex includes a single quote. Hopefully
no one needs to match a double quote for awhile...
TBR=darin
Review URL: https://codereview.chromium.org/12040055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/safe_numerics_unittest.nc')
-rw-r--r-- | base/safe_numerics_unittest.nc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/base/safe_numerics_unittest.nc b/base/safe_numerics_unittest.nc index 4a3c57e..4219cd5 100644 --- a/base/safe_numerics_unittest.nc +++ b/base/safe_numerics_unittest.nc @@ -2,16 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <float.h> + #include "base/safe_numerics.h" -namespace base { -namespace internal { +using base::internal::IsValidNumericCast; + +#if defined(NCTEST_NO_FLOATING_POINT_1) // [r"size of array is negative"] -void NoFloatingPoint { +void WontCompile() { IsValidNumericCast<float>(0.0); +} + +#elif defined(NCTEST_NO_FLOATING_POINT_2) // [r"size of array is negative"] + +void WontCompile() { IsValidNumericCast<double>(0.0f); +} + +#elif defined(NCTEST_NO_FLOATING_POINT_3) // [r"size of array is negative"] + +void WontCompile() { IsValidNumericCast<int>(DBL_MAX); } -} // namespace internal -} // namespace base +#endif |