Line data Source code
1 : // Copyright 2017 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 "test/unittests/test-utils.h"
6 :
7 : #include "src/wasm/wasm-opcodes.h"
8 :
9 : namespace v8 {
10 : namespace internal {
11 : namespace wasm {
12 :
13 2 : class WasmOpcodesTest : public TestWithZone {};
14 :
15 15444 : TEST_F(WasmOpcodesTest, EveryOpcodeHasAName) {
16 : static const struct {
17 : WasmOpcode opcode;
18 : const char* debug_name;
19 : } kValues[] = {
20 : #define DECLARE_ELEMENT(name, opcode, sig) {kExpr##name, "kExpr" #name},
21 : FOREACH_OPCODE(DECLARE_ELEMENT)};
22 : #undef DECLARE_ELEMENT
23 :
24 865 : for (size_t i = 0; i < arraysize(kValues); i++) {
25 432 : const char* result = WasmOpcodes::OpcodeName(kValues[i].opcode);
26 432 : if (strcmp("unknown", result) == 0) {
27 0 : EXPECT_TRUE(false) << "WasmOpcodes::OpcodeName(" << kValues[i].debug_name
28 : << ") == \"unknown\";"
29 0 : " plazz halp in src/wasm/wasm-opcodes.cc";
30 : }
31 : }
32 1 : }
33 : } // namespace wasm
34 : } // namespace internal
35 9264 : } // namespace v8
|