Example #1
0
        public void OnlyChildWithUnivals(ISolution solution)
        {
            /*     0
             \
             \       0
             \      / \
             \     1   0
             \    /
             \   1
             \  / \
             \ 1   1
             */
            Node root =
                new Node(false
                         , null
                         , new Node(false
                                    , new Node(true
                                               , new Node(true
                                                          , new Node(true)
                                                          , new Node(true)
                                                          )
                                               , null
                                               )
                                    , new Node(false)
                                    )
                         );

            Assert.Equal(4, solution.Execute(root));
        }
Example #2
0
        public void GivenTest(ISolution solution)
        {
            /*     0
             *    / \
             *   1   0
             *      / \
             *     1   0
             *    / \
             *   1   1
             */
            Node root =
                new Node(false
                         , new Node(true)
                         , new Node(false
                                    , new Node(true
                                               , new Node(true)
                                               , new Node(true)
                                               )
                                    , new Node(false)
                                    ));

            Assert.Equal(5, solution.Execute(root));
        }
Example #3
0
 public void GivenTestB(ISolution solution)
 => Assert.Equal(10, solution.Execute(new int[] { 5, 1, 1, 5 }));
 public int SumPass() => sumPass.Execute(input);
Example #5
0
 public void GivenTestB(ISolution solution) =>
 Assert.Equal(
     new ulong[] { 2, 3, 6 },
     solution.Execute(new ushort[] { 3, 2, 1 }));
Example #6
0
 public void Duplicates(ISolution solution)
 => Assert.Equal(1, solution.Execute(new int[] { 5, 5, 5, 5, 5 }));
Example #7
0
 public void NoValidCandidates(ISolution solution)
 => Assert.Equal(1, solution.Execute(new int[] { -1, 5, 0 }));
Example #8
0
 public void GivenTestA(ISolution solution)
 => Assert.Equal(13, solution.Execute(new int[] { 2, 4, 6, 2, 5 }));
Example #9
0
 public void SingleElement(ISolution solution)
 => Assert.Equal(3, solution.Execute(new int[] { 3 }));
Example #10
0
 public void AllValid(ISolution solution)
 => Assert.Equal(8, solution.Execute("12211"));
Example #11
0
 public void Empty(ISolution solution)
 => Assert.Equal(0, solution.Execute(""));
Example #12
0
 public void OnlyRoot(ISolution solution)
 => Assert.Equal(1, solution.Execute(new Node(true)));
Example #13
0
 public void NearFar() => nearFar.Execute(input);
 public int SumPassNoCast() => sumPassNoCast.Execute(input);
Example #15
0
 public void Null(ISolution solution)
 => Assert.Equal(0, solution.Execute(null));
Example #16
0
 public void HighDigits(ISolution solution)
 => Assert.Equal(2, solution.Execute("91281"));
Example #17
0
 public void Empty(ISolution solution)
 => Assert.Equal(0, solution.Execute(new int[] { }));
Example #18
0
 public void Zeroes(ISolution solution)
 => Assert.Equal(1, solution.Execute("110201010"));
Example #19
0
 public void TwoElements(ISolution solution)
 => Assert.Equal(5, solution.Execute(new int[] { 3, 5 }));
Example #20
0
 public void GivenTest(ISolution solution)
 => Assert.Equal(3, solution.Execute("111"));
Example #21
0
 public void GivenTestB(ISolution solution)
 => Assert.Equal(3, solution.Execute(new int[] { 1, 2, 0 }));
Example #22
0
 public void CantUseSameIndexTwice(ISolution solution) =>
 Assert.False(solution.Execute(new byte[] { 3, 5, 6 }, 10));
Example #23
0
 public void NoFirstStep(ISolution solution)
 => Assert.Equal(1, solution.Execute(new int[] { 7, 6, -1, 3, 5, 4 }));
Example #24
0
 public void CanUseSameValueTwice(ISolution solution) =>
 Assert.True(solution.Execute(new byte[] { 3, 5, 5, 6 }, 10));
Example #25
0
 public void GivenTestA(ISolution solution)
 => Assert.Equal(2, solution.Execute(new int[] { 3, 4, -1, 1 }));
Example #26
0
 public void GivenTest(ISolution solution) =>
 Assert.True(solution.Execute(new byte[] { 10, 15, 3, 7 }, 17));
Example #27
0
 public void GivenTestA(ISolution solution) =>
 Assert.Equal(
     new ulong[] { 120, 60, 40, 30, 24 },
     solution.Execute(new ushort[] { 1, 2, 3, 4, 5 }));
 public int Recursion() => recursion.Execute(input);