public static void AreEqual(Flags flags, Tv expected, State state) { foreach (Flags flag in FlagTools.GetFlags(flags)) { TestTools.AreEqual(expected, state.GetTv(flag)); } }
public static void AreEqual(Flags flags, Tv expected, State state) { Contract.Requires(state != null); foreach (Flags flag in FlagTools.GetFlags(flags)) { AreEqual(expected, state.GetTv(flag)); } }
public void SetAsmSim(AsmSimulator asmSimulator, int lineNumber, bool isExpanded) { this._asmSimulator = asmSimulator; this._lineNumber = lineNumber; bool empty = true; if (this._asmSimulator.Enabled & Settings.Default.AsmSim_Show_Register_In_Instruction_Tooltip) { this._itemsOnPage = new List <TextBox>(); this.AsmSimGridExpander.IsExpanded = isExpanded; this.AsmSimGridExpanderNumeration.Text = Settings.Default.AsmSim_Show_Register_In_Instruction_Tooltip_Numeration; var(ReadReg, WriteReg, ReadFlag, WriteFlag, MemRead, MemWrite) = this._asmSimulator.Get_Usage(lineNumber); var readReg = new HashSet <Rn>(ReadReg); var writeReg = new HashSet <Rn>(WriteReg); this.GenerateHeader(); int row = 2; foreach (Rn reg in Enum.GetValues(typeof(Rn))) { bool b1 = readReg.Contains(reg); bool b2 = writeReg.Contains(reg); if (b1 || b2) { empty = false; if (b1) { this.Generate(reg, true, row); } if (b2) { this.Generate(reg, false, row); } row++; } } foreach (Flags flag in FlagTools.GetFlags(ReadFlag | WriteFlag)) { if (flag == Flags.NONE) { continue; } bool b1 = ReadFlag.HasFlag(flag); bool b2 = WriteFlag.HasFlag(flag); if (b1 || b2) { empty = false; if (b1) { this.Generate(flag, true, row); } if (b2) { this.Generate(flag, false, row); } row++; } } } this.AsmSimGridExpander.Visibility = (empty) ? Visibility.Collapsed : Visibility.Visible; this.AsmSimGridBorder.Visibility = (empty) ? Visibility.Collapsed : Visibility.Visible; this.AsmSimGridExpanderNumeration.SelectionChanged += (sender, i) => { string numerationStr = ((sender as ComboBox).SelectedItem as ComboBoxItem).Content.ToString(); NumerationEnum numeration = AsmSourceTools.ParseNumeration(numerationStr); if (numeration == NumerationEnum.UNKNOWN) { AsmDudeToolsStatic.Output_WARNING("SetAsmSim:smSimGridExpanderNumeration.SelectionChanged: unknown numerationStr=" + numerationStr); } //AsmDudeToolsStatic.Output_INFO("AsmSimGridExpanderNumeration:SelectionChanged: numeration="+ numeration); foreach (var textBox in this._itemsOnPage) { var info = textBox.Tag as ButtonInfo; string content = (info.reg == Rn.NOREG) ? this._asmSimulator.Get_Flag_Value_If_Already_Computed(info.flag, this._lineNumber, info.before) : this._asmSimulator.Get_Register_Value_If_Already_Computed(info.reg, this._lineNumber, info.before, numeration); if (content != null) { textBox.Text = info.reg.ToString() + " = " + content; } } }; }