1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
11size_t compute_instruction_size(
WireOpCode wire_opcode,
15 size_t instr_size = 1;
16 for (
const auto& operand_type : wire_format.at(wire_opcode)) {
17 instr_size += operand_type_sizes.at(operand_type);
25TEST(InstructionSpecTest, CheckAllInstructionSizes)
31 const auto wire_opcode =
static_cast<WireOpCode>(i);
32 const auto computed_size = compute_instruction_size(wire_opcode, wire_format, operand_type_sizes);
34 <<
"Incorrect size_in_bytes field for " << wire_opcode <<
" in WIRE_INSTRUCTION_SPEC.";
40TEST(InstructionSpecTest, CheckAllInstructionsTagInformation)
45 const auto wire_opcode =
static_cast<WireOpCode>(i);
46 const auto& operands = wire_format.at(wire_opcode);
50 if (wire_instruction_spec.tag_operand_idx.has_value()) {
51 EXPECT_EQ(tag_counts, 1);
52 if (wire_instruction_spec.tag_operand_idx.value() == 2) {
58 EXPECT_EQ(tag_counts, 0);
const std::unordered_map< OperandType, uint32_t > & get_operand_type_sizes()
const std::unordered_map< WireOpCode, std::vector< OperandType > > & get_instruction_wire_formats()
TEST(EmitUnencryptedLogTest, Basic)
const std::unordered_map< WireOpCode, WireInstructionSpec > WIRE_INSTRUCTION_SPEC
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept