public void Example1(string s, params int[] values) { var program = DockingProgram.Parse(s); Assert.Equal((uint)values[0], program.Or); Assert.Equal((uint)values[1], program.Xor); Assert.Equal(values[2], program.Routines[0].Location); Assert.Equal((uint)values[3], program.Routines[0].Value); Assert.Equal(values[4], program.Routines[1].Location); Assert.Equal((uint)values[5], program.Routines[1].Value); Assert.Equal(values[6], program.Routines[2].Location); Assert.Equal((uint)values[7], program.Routines[2].Value); }
public void Example2(string s, ulong expected) { var locations = new Dictionary <int, ulong>(); var program = DockingProgram.Parse(s); foreach (var routine in program.Routines) { var result = ApplyMasks(routine.Value, program.Or, program.Xor); if (!locations.TryAdd(routine.Location, result)) { locations[routine.Location] = result; } } Assert.Equal( expected, locations.GetValues().Sum()); }