90c8932596
Our own ARRAY_SIZE() was pretty bad at error checking. If you use arrasize() in a wrong way, the compiler will issue an error instead of silently doing the wrong thing. The previous ARRAY_SIZE() macro is still available as ARRAYSIZE_UNSAFE() similar to Chrome. R=yangguo@chromium.org Review URL: https://codereview.chromium.org/501323002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23389 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
27 lines
692 B
C++
27 lines
692 B
C++
// Copyright 2014 the V8 project 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 "src/checks.h"
|
|
|
|
#include "test/cctest/cctest.h"
|
|
|
|
|
|
TEST(CheckEqualsZeroAndMinusZero) {
|
|
CHECK_EQ(0.0, 0.0);
|
|
CHECK_NE(0.0, -0.0);
|
|
CHECK_NE(-0.0, 0.0);
|
|
CHECK_EQ(-0.0, -0.0);
|
|
}
|
|
|
|
|
|
TEST(CheckEqualsReflexivity) {
|
|
double inf = V8_INFINITY;
|
|
double nan = v8::base::OS::nan_value();
|
|
double constants[] = {-nan, -inf, -3.1415, -1.0, -0.1, -0.0,
|
|
0.0, 0.1, 1.0, 3.1415, inf, nan};
|
|
for (size_t i = 0; i < arraysize(constants); ++i) {
|
|
CHECK_EQ(constants[i], constants[i]);
|
|
}
|
|
}
|