v8/test/unittests/compiler/js-native-context-specialization-unittest.cc
Manos Koukoutos 2a0584bfe8 [test] Remove some unused includes (2)
Mostly test/fuzzer, test/inspector, test/unittests.

Bug: v8:13006
Change-Id: I825efa5d72a224bb3cb9f86a9fac8763e9dbd1cf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769696
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81799}
2022-07-19 08:55:55 +00:00

48 lines
1.5 KiB
C++

// 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/compiler/js-native-context-specialization.h"
#include "src/compiler/js-operator.h"
#include "test/unittests/compiler/graph-unittest.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace js_native_context_specialization_unittest {
class JSNativeContextSpecializationTest : public GraphTest {
public:
explicit JSNativeContextSpecializationTest(int num_parameters = 1)
: GraphTest(num_parameters), javascript_(zone()) {}
~JSNativeContextSpecializationTest() override {}
protected:
JSOperatorBuilder* javascript() { return &javascript_; }
private:
JSOperatorBuilder javascript_;
};
TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) {
const size_t str_len = 3;
const size_t num_len = kMaxDoubleStringLength;
Node* const str_node = graph()->NewNode(
common()->HeapConstant(factory()->InternalizeUtf8String("str")));
EXPECT_EQ(
JSNativeContextSpecialization::GetMaxStringLength(broker(), str_node),
str_len);
Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3));
EXPECT_EQ(
JSNativeContextSpecialization::GetMaxStringLength(broker(), num_node),
num_len);
}
} // namespace js_native_context_specialization_unittest
} // namespace compiler
} // namespace internal
} // namespace v8