Esempio n. 1
0
        public void Acceptance()
        {
            var expected = new[] { 5, 7, 11, 13, 17, 19, 23, 29 };

            Assert.Equal(expected, Primefactors.Of(expected.Aggregate(1, (a, b) => a * b)));
            Assert.Equal(expected, Primefactors2.Of(expected.Aggregate(1, (a, b) => a * b)));
        }
Esempio n. 2
0
        public void Performance()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            Primefactors.Of(int.MaxValue);
            stopwatch.Stop();
            Assert.True(stopwatch.ElapsedMilliseconds < 2000, $"Performance issue, running for {stopwatch.ElapsedMilliseconds} ms.");
        }
Esempio n. 3
0
 public void Of_Number_ExpectedResult(int number, params int[] expected)
 {
     Assert.Equal(expected, Primefactors.Of(number));
     Assert.Equal(expected, Primefactors2.Of(number));
 }