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

Unified Diff: test/unittests/runtime/runtime-interpreter-unittest.cc

Issue 1744163002: [stubs] Introduce a proper ToBooleanStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips Created 4 years, 10 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/type-info.h ('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/runtime/runtime-interpreter-unittest.cc
diff --git a/test/unittests/runtime/runtime-interpreter-unittest.cc b/test/unittests/runtime/runtime-interpreter-unittest.cc
deleted file mode 100644
index c10ddcd3191374b05f1ddebdc883201f91c878d7..0000000000000000000000000000000000000000
--- a/test/unittests/runtime/runtime-interpreter-unittest.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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/v8.h"
-
-#include "src/factory.h"
-#include "src/heap/heap.h"
-#include "src/heap/heap-inl.h"
-#include "src/runtime/runtime.h"
-#include "test/unittests/test-utils.h"
-
-namespace v8 {
-namespace internal {
-namespace interpreter {
-
-class RuntimeInterpreterTest : public TestWithIsolateAndZone {
- public:
- typedef Object* (*RuntimeMethod)(int, Object**, Isolate*);
-
- RuntimeInterpreterTest() {}
- ~RuntimeInterpreterTest() override {}
-
- bool TestOperatorWithObjects(RuntimeMethod method, Handle<Object> lhs,
- Handle<Object> rhs, bool expected);
-};
-
-
-bool RuntimeInterpreterTest::TestOperatorWithObjects(RuntimeMethod method,
- Handle<Object> lhs,
- Handle<Object> rhs,
- bool expected) {
- Object* args_object[] = {*rhs, *lhs};
- Handle<Object> result =
- handle(method(2, &args_object[1], isolate()), isolate());
- CHECK(result->IsTrue() || result->IsFalse());
- return result->IsTrue() == expected;
-}
-
-
-TEST_F(RuntimeInterpreterTest, ToBoolean) {
- double quiet_nan = std::numeric_limits<double>::quiet_NaN();
- std::pair<Handle<Object>, bool> cases[] = {
- std::make_pair(isolate()->factory()->NewNumberFromInt(0), false),
- std::make_pair(isolate()->factory()->NewNumberFromInt(1), true),
- std::make_pair(isolate()->factory()->NewNumberFromInt(100), true),
- std::make_pair(isolate()->factory()->NewNumberFromInt(-1), true),
- std::make_pair(isolate()->factory()->NewNumber(7.7), true),
- std::make_pair(isolate()->factory()->NewNumber(0.00001), true),
- std::make_pair(isolate()->factory()->NewNumber(quiet_nan), false),
- std::make_pair(isolate()->factory()->NewHeapNumber(0.0), false),
- std::make_pair(isolate()->factory()->undefined_value(), false),
- std::make_pair(isolate()->factory()->null_value(), false),
- std::make_pair(isolate()->factory()->true_value(), true),
- std::make_pair(isolate()->factory()->false_value(), false),
- std::make_pair(isolate()->factory()->NewStringFromStaticChars(""), false),
- std::make_pair(isolate()->factory()->NewStringFromStaticChars("_"), true),
- };
-
- for (size_t i = 0; i < arraysize(cases); i++) {
- auto& value_expected_tuple = cases[i];
- Object* args_object[] = {*value_expected_tuple.first};
- Handle<Object> result = handle(
- Runtime_InterpreterToBoolean(1, &args_object[0], isolate()), isolate());
- CHECK(result->IsBoolean());
- CHECK_EQ(result->IsTrue(), value_expected_tuple.second);
- }
-}
-
-
-} // namespace interpreter
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/type-info.h ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698