public void CompareTripletsTest(int[] a, int[] b)
        {
            List <int> aList = new List <int>(a);
            List <int> bList = new List <int>(b);
            var        res   = CompareTriplets.Run(aList, bList);


            // var result = obj.Run(a,b);
        }
        public void CompareTest()
        {
            var listA = new List <int> {
                10, 20, 30
            };
            var listB = new List <int> {
                30, 20, 10
            };

            var listResult = CompareTriplets.Compare(listA, listB);

            Assert.IsTrue(listResult.Count == 2);
            Assert.IsTrue(listResult[0] == 1);
            Assert.IsTrue(listResult[1] == 1);
        }
        public void ShouldScoreBothTied()
        {
            //arrange
            int             a0 = 0;
            int             a1 = 0;
            int             a2 = 0;
            int             b0 = 0;
            int             b1 = 0;
            int             b2 = 0;
            string          expectedOutcome = "0 0";
            CompareTriplets compare         = new CompareTriplets(a0, a1, a2, b0, b1, b2);

            //act
            string score = compare.Outcome();

            //assert
            score.Should().Be(expectedOutcome);
        }
        public void ShouldScoreBothSides()
        {
            //arrange
            int             a0 = 1;
            int             a1 = 3;
            int             a2 = 5;
            int             b0 = 4;
            int             b1 = 3;
            int             b2 = 1;
            string          expectedOutcome = "1 1";
            CompareTriplets compare         = new CompareTriplets(a0, a1, a2, b0, b1, b2);

            //act
            string score = compare.Outcome();

            //assert
            score.Should().Be(expectedOutcome);
        }
        public void ShouldScoreWinnerB()
        {
            //arrange
            int             a0 = 1;
            int             a1 = 2;
            int             a2 = 3;
            int             b0 = 4;
            int             b1 = 5;
            int             b2 = 6;
            string          expectedOutcome = "0 3";
            CompareTriplets compare         = new CompareTriplets(a0, a1, a2, b0, b1, b2);

            //act
            string score = compare.Outcome();

            //assert
            score.Should().Be(expectedOutcome);
        }
Example #6
0
        static void Main(string[] args)
        {
            int varProgram = 0;

            Console.WriteLine("Please enter the number of the program you'd like to run. \n" +
                              "1. Simple Sum Array \n" +
                              "2. Compare The Triplets \n" +
                              "3. A Very Big Sum \n" +
                              "4. Exit \n");

            // varProgram stores the choice of the user.
            varProgram = Int32.Parse(Console.ReadLine());

            switch (varProgram)
            {
            case 1:
                SimpleSumArray.Main();
                break;

            case 2:
                CompareTriplets.Main();
                break;

            case 3:
                BigSum.Main();
                break;

            case 4:
                Console.WriteLine("Have a nice day!");
                break;

            default:
                Console.WriteLine("You didn't enter a valid number.");
                break;
            }


            Console.ReadLine();
        }
Example #7
0
 private string ReturnTriplets(int a0, int a1, int a2, int b0, int b1, int b2)
 {
     return(CompareTriplets.GetCompareTriplets(a0, a1, a2, b0, b1, b2));
 }