2014-07-30 13:54:45 +00:00
|
|
|
// 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) {
|
2014-12-20 13:17:20 +00:00
|
|
|
double inf = V8_INFINITY;
|
2014-07-30 13:54:45 +00:00
|
|
|
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};
|
2014-08-26 09:19:24 +00:00
|
|
|
for (size_t i = 0; i < arraysize(constants); ++i) {
|
2014-07-30 13:54:45 +00:00
|
|
|
CHECK_EQ(constants[i], constants[i]);
|
|
|
|
}
|
|
|
|
}
|