summaryrefslogtreecommitdiff
path: root/chromium/base/safe_numerics_unittest.nc
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
committerZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
commit679147eead574d186ebf3069647b4c23e8ccace6 (patch)
treefc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/base/safe_numerics_unittest.nc
downloadqtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz
Initial import.
Diffstat (limited to 'chromium/base/safe_numerics_unittest.nc')
-rw-r--r--chromium/base/safe_numerics_unittest.nc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chromium/base/safe_numerics_unittest.nc b/chromium/base/safe_numerics_unittest.nc
new file mode 100644
index 00000000000..4219cd56a46
--- /dev/null
+++ b/chromium/base/safe_numerics_unittest.nc
@@ -0,0 +1,29 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// 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"
+
+using base::internal::IsValidNumericCast;
+
+#if defined(NCTEST_NO_FLOATING_POINT_1) // [r"size of array is negative"]
+
+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);
+}
+
+#endif