public void Factor_Input28_Output1_2_4_7_14_28()
 {
     Assert.Equal(Divisors.AllDivisors(28), new HashSet <long>()
     {
         1, 2, 4, 7, 14, 28
     });
 }
 public void Factor_Input1_Output1()
 {
     Assert.Equal(Divisors.AllDivisors(1), new HashSet <long>()
     {
         1
     });
 }
 public void Factor_Input21_Output1_3_7_21()
 {
     Assert.Equal(Divisors.AllDivisors(21), new HashSet <long>()
     {
         1, 3, 7, 21
     });
 }
 public void Factor_Input15_Output1_3_5_15()
 {
     Assert.Equal(Divisors.AllDivisors(15), new HashSet <long>()
     {
         1, 3, 5, 15
     });
 }
 public void Factor_Input10_Output1_2_5_10()
 {
     Assert.Equal(Divisors.AllDivisors(10), new HashSet <long>()
     {
         1, 2, 5, 10
     });
 }
 public void Factor_Input6_Output1_2_3_6()
 {
     Assert.Equal(Divisors.AllDivisors(6), new HashSet <long>()
     {
         1, 2, 3, 6
     });
 }
 public void Factor_Input3_Output1_3()
 {
     Assert.Equal(Divisors.AllDivisors(3), new HashSet <long>()
     {
         1, 3
     });
 }
示例#8
0
        public void TestDivisors(uint n, uint[] divisors)
        {
            int i = 0;

            foreach (uint divisor in Divisors.AllDivisors(n))
            {
                Assert.LessThan(i, divisors.Length, "Expected {0}<{1} for number {2}", i, divisors.Length, n);
                Assert.AreEqual(divisors[i++], divisor);
            }
        }