v8/test/cctest/test-checks.cc
bmeurer 31c66e2d53 Remove obsolete V8_INFINITY macro.
Use std::numeric_limits consistently.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/798413003

Cr-Commit-Position: refs/heads/master@{#25897}
2014-12-19 07:18:00 +00:00

27 lines
720 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 = std::numeric_limits<double>::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]);
}
}