Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: test/unittests/factory-unittest.cc

Issue 857783002: [turbofan] Make Factory::NewNumber() always return the minus_zero_value. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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/factory.h"
6 #include "src/handles-inl.h"
7 #include "test/unittests/test-utils.h"
8 #include "testing/gmock-support.h"
9
10 using testing::BitEq;
11
12 namespace v8 {
13 namespace internal {
14
15 typedef TestWithIsolate FactoryTest;
16
17
18 namespace {
19
20 const PretenureFlag kPretenureFlags[] = {TENURED, NOT_TENURED};
21
22 } // namespace
23
24
25 TEST_F(FactoryTest, MinusZeroValue) {
26 Handle<Object> minus_zero_value = factory()->minus_zero_value();
27 EXPECT_TRUE(minus_zero_value->IsHeapNumber());
28 EXPECT_THAT(minus_zero_value->Number(), BitEq(-0.0));
29 }
30
31
32 TEST_F(FactoryTest, NewNumberWithMinusZero) {
33 Handle<Object> minus_zero_value = factory()->minus_zero_value();
34 TRACED_FOREACH(PretenureFlag, pretenure_flag, kPretenureFlags) {
35 EXPECT_TRUE(minus_zero_value.is_identical_to(
36 factory()->NewNumber(-0.0, pretenure_flag)));
37 }
38 }
39
40
41 TEST_F(FactoryTest, NewHeapNumberWithMinusZero) {
42 TRACED_FOREACH(PretenureFlag, pretenure_flag, kPretenureFlags) {
43 Handle<Object> value =
44 factory()->NewHeapNumber(-0.0, IMMUTABLE, pretenure_flag);
45 EXPECT_TRUE(value->IsHeapNumber());
46 EXPECT_THAT(value->Number(), BitEq(-0.0));
47 EXPECT_FALSE(value.is_identical_to(factory()->minus_zero_value()));
48 }
49 }
50
51 } // namespace internal
52 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698