private void TestFunction(IMajorityFunction func) { for (int i = 0; i < input.Length; i++) { Assert.AreEqual(expected[i], func.HasMajority(input[i])); } }
public void RunTest(IMajorityFunction func) { Random r = new Random(); data = new int[m_amount]; for (int i = 0; i < m_amount; i++) { data[i] = r.Next(); } for (int step = 1; step <= m_times; step++) { Console.Write("We start step " + step + ": "); Stopwatch sw = Stopwatch.StartNew(); bool res = func.HasMajority(data); Console.WriteLine("...Done! Time: {0}", sw.ElapsedMilliseconds); } }