TEST(BinaryReader, DisabledOpcodes) { // Use the default features.
ReadBinaryOptions options;
// Loop through all opcodes.
for (uint32_t i = 0; i < static_cast<uint32_t>(Opcode::Invalid); ++i) {
Opcode opcode(static_cast<Opcode::Enum>(i));
if (opcode.IsEnabled(options.features)) { continue;
}
// Use a shorter name to make the clang-formatted table below look nicer.
std::vector<uint8_t> b = opcode.GetBytes();
assert(b.size() <= 3);
b.resize(3);
BinaryReaderError reader;
Result result = ReadBinary(data, size, &reader, options);
EXPECT_EQ(Result::Error, result);
// This relies on the binary reader checking whether the opcode is allowed // before reading any further data needed by the instruction. const std::string& message = reader.first_error.message;
EXPECT_EQ(0u, message.find("unexpected opcode"))
<< "Got error message: " << message;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.