blob: 79e87ddd0c8572d7bb531f8a8e64cd37a506d16c [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "src/checks.h"
6
7#include "test/cctest/cctest.h"
8
9
10TEST(CheckEqualsZeroAndMinusZero) {
11 CHECK_EQ(0.0, 0.0);
12 CHECK_NE(0.0, -0.0);
13 CHECK_NE(-0.0, 0.0);
14 CHECK_EQ(-0.0, -0.0);
15}
16
17
18TEST(CheckEqualsReflexivity) {
19 double inf = V8_INFINITY;
20 double nan = v8::base::OS::nan_value();
21 double constants[] = {-nan, -inf, -3.1415, -1.0, -0.1, -0.0,
22 0.0, 0.1, 1.0, 3.1415, inf, nan};
23 for (size_t i = 0; i < arraysize(constants); ++i) {
24 CHECK_EQ(constants[i], constants[i]);
25 }
26}