public void Run() { var def = Core.Defs.First(x => x.Name == Class); var state = ExecutionState.Cleanroom(); state.Registers["PC"] = TestGen.PC; var locals = state.Locals; foreach (var field in def.Fields) { locals[field.Key] = (Instruction >> field.Value.Shift) & ((1U << field.Value.Bits) - 1); } state.Evaluate((PTree)def.Decode); foreach (var(key, value) in Preconditions) { if (key is ulong page) { state.Memory[page] = value; } else { state.Registers[(string)key] = value; } } state.Evaluate((PTree)def.Eval); foreach (var(key, value) in Postconditions) { if (key is ulong page) { Assert.AreEqual(value, state.Memory[page], $"[0x{page << 12:X}]"); } else if (((object)value).GetType().IsConstructedGenericType&& ((object)value).GetType().GetGenericTypeDefinition() == typeof(Vector128 <>)) { Assert.AreEqual(value.As <byte>(), state.Registers[(string)key].As <byte>(), (string)key); } else { Assert.AreEqual(value, state.Registers[(string)key], (string)key); } } }