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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/factory-unittest.cc
diff --git a/test/unittests/factory-unittest.cc b/test/unittests/factory-unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b090886e105ff3987d257f192dd217a4fdcfbea4
--- /dev/null
+++ b/test/unittests/factory-unittest.cc
@@ -0,0 +1,52 @@
+// Copyright 2015 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/factory.h"
+#include "src/handles-inl.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gmock-support.h"
+
+using testing::BitEq;
+
+namespace v8 {
+namespace internal {
+
+typedef TestWithIsolate FactoryTest;
+
+
+namespace {
+
+const PretenureFlag kPretenureFlags[] = {TENURED, NOT_TENURED};
+
+} // namespace
+
+
+TEST_F(FactoryTest, MinusZeroValue) {
+ Handle<Object> minus_zero_value = factory()->minus_zero_value();
+ EXPECT_TRUE(minus_zero_value->IsHeapNumber());
+ EXPECT_THAT(minus_zero_value->Number(), BitEq(-0.0));
+}
+
+
+TEST_F(FactoryTest, NewNumberWithMinusZero) {
+ Handle<Object> minus_zero_value = factory()->minus_zero_value();
+ TRACED_FOREACH(PretenureFlag, pretenure_flag, kPretenureFlags) {
+ EXPECT_TRUE(minus_zero_value.is_identical_to(
+ factory()->NewNumber(-0.0, pretenure_flag)));
+ }
+}
+
+
+TEST_F(FactoryTest, NewHeapNumberWithMinusZero) {
+ TRACED_FOREACH(PretenureFlag, pretenure_flag, kPretenureFlags) {
+ Handle<Object> value =
+ factory()->NewHeapNumber(-0.0, IMMUTABLE, pretenure_flag);
+ EXPECT_TRUE(value->IsHeapNumber());
+ EXPECT_THAT(value->Number(), BitEq(-0.0));
+ EXPECT_FALSE(value.is_identical_to(factory()->minus_zero_value()));
+ }
+}
+
+} // namespace internal
+} // namespace v8
« 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