Ejemplo n.º 1
0
        public void Test_HowManyDup()
        {
            int[]  dups     = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 };
            string expected = "1 -> 2x \n"
                              + "2 -> 1x \n"
                              + "3 -> 3x \n"
                              + "4 -> 2x \n"
                              + "5 -> 3x \n";

            Assert.Equal(expected, HowManyDuplicates.Dup(dups));
        }
Ejemplo n.º 2
0
        public void Duplicates()
        {
            int[] dups = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 };

            string hasil = "1 -> 3x \n"
                           + "2 -> 1x \n"
                           + "3 -> 3x \n"
                           + "4 -> 2x \n"
                           + "5 -> 3x \n";

            Assert.Equal(hasil, HowManyDuplicates.duplicate(dups));
        }
Ejemplo n.º 3
0
        public void cekHowManyDup()
        {
            int[] numbers = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 };

            string hasil = "jumlah 1 sebanyak 3\n" +
                           "jumlah 3 sebanyak 3\n" +
                           "jumlah 5 sebanyak 3\n" +
                           "jumlah 4 sebanyak 2\n" +
                           "jumlah 2 sebanyak 1\n";

            Assert.Equal(hasil, HowManyDuplicates.Run(numbers));
        }
Ejemplo n.º 4
0
        public void tes_how_many_duplicate()
        {
            int[] dups     = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 };
            var   expected = new SortedList <int, int>();

            expected.Add(1, 3);
            expected.Add(2, 1);
            expected.Add(3, 3);
            expected.Add(4, 2);
            expected.Add(5, 3);

            Assert.Equal(expected, HowManyDuplicates.Run(dups));
        }