Ejemplo n.º 1
0
        public void FizzBuzzNegative()
        {
            int[] input    = { -4, -3, -6, -30, -10, -12 };
            int[] output   = CubeFilter.FizzBuzz(input);
            int[] expected = { -4, 3, 3, 0, 5, 3 };

            CollectionAssert.AreEqual(expected, output);
        }
        public void CubeFilterSimple()
        {
            int[] input    = { 1, 3, 5, 7, 9, 999 };
            int[] output   = CubeFilter.cubes(input);
            int[] expected = { 1, 27, 125, 343, 729, 997002999 };

            CollectionAssert.AreEqual(expected, output);
        }
Ejemplo n.º 3
0
        public void FizzBuzzSimple()
        {
            int[] input    = { 4, 3, 6, 30, 10, 12 };
            int[] output   = CubeFilter.FizzBuzz(input);
            int[] expected = { 4, 3, 3, 0, 5, 3 };

            CollectionAssert.AreEqual(expected, output);
        }
Ejemplo n.º 4
0
        public void FizzBuzzZero()
        {
            int[] input    = { 0 };
            int[] output   = CubeFilter.FizzBuzz(input);
            int[] expected = { 0 };

            CollectionAssert.AreEqual(expected, output);
        }
Ejemplo n.º 5
0
    public void FilterTest()
    {
        int[] input  = { 4, 3, 6, 30, 10, 12 };
        int[] output = CubeFilter.cubes(input);
        int[] result = { 4, 3, 3, 0, 5, 3 };

        CubeFilterTest.Equals(output, result);
    }
Ejemplo n.º 6
0
        public void collatzTest()
        {
            int[] array  = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[] target = new int[] { 2, 1, 8, 2, 14, 3, 20, 4, 26 };
            // Use the Assert class to test conditions.
            // Use yield to skip a frame.
            array = CubeFilter.cubes(array);


            Assert.AreEqual(array, target);
        }
Ejemplo n.º 7
0
        [Test] // this tells system this is a test function and it needs to be ran
        public void CubeFilterSimple()
        {
            int[] input    = { 1, 3, 5, 7, 9, 999 };
            int[] output   = CubeFilter.cubes(input);
            int[] expected = { 1, 27, 125, 343, 729, 997002999 };


            CollectionAssert.AreEqual(expected, output); // this checks output with the input to make sure they are the same
                                                         // collection assert - tells test runner this is a check that needs to pass otherwise unit test fails.

            // convention in most libraries -  is expected first then output second.
            // due to language of report. avoid error when reading the debug output.
        }
        public void CubeFilterSimple()
        {
            int[] input    = { 1, 3, 5, 7, 9, 999 };
            int[] output   = CubeFilter.cubes(input);
            int[] expected = { 1, 27, 125, 343, 729, 997002999 };

            foreach (var o in output)
            {
                Debug.Log(o);
            }

            CollectionAssert.AreEqual(expected, output);
        }
        public void CubeFilterFact()
        {
            int[] input    = { 4, 2, 8, 3, 9, 4, 10, -2, 0 };
            int[] output   = CubeFilter.fact(input);
            int[] expected = { 24, 2, 40320, 6, 362880, 24, 3628800, 0, 0 };

            foreach (var o in output)
            {
                Debug.Log(o);
            }

            CollectionAssert.AreEqual(expected, output);
        }
Ejemplo n.º 10
0
        public void CubeFilterSimple()
        {
            //Assert.IsTrue(false);

            int[] input    = { 1, 3, 5, 7, 9 };
            int[] output   = CubeFilter.cubes(input);
            int[] expected = { 1, 27, 125, 343, 729 };

            //foreach (var o in output)
            //{
            //    Debug.Log(o);
            //}

            CollectionAssert.AreEqual(expected, output);
        }
Ejemplo n.º 11
0
 public static int[] combinedFilter(int[] xs)
 {
     return(Modulo3Filter.moduloInput(CubeFilter.cubes(xs)));
 }
 public void CubeFilterOverflow()
 {
     Assert.Throws <System.OverflowException>(() => CubeFilter.cube(9999));
 }