Esempio n. 1
0
        public void CountClamsTest()
        {
            Exercises newClamps = new Exercises();

            int[] set1 = new int[6] {
                1, 2, 2, 3, 4, 4
            };
            int[] set2 = new int[5] {
                1, 1, 2, 1, 1
            };
            int[] set3 = new int[5] {
                1, 1, 1, 1, 1
            };

            Assert.AreEqual(2, newClamps.CountClumps(set1));
            Assert.AreEqual(2, newClamps.CountClumps(set2));
            Assert.AreEqual(1, newClamps.CountClumps(set3));
        }
Esempio n. 2
0
        public void CountClumpsTest()
        {
            Exercises e = new Exercises();

            Assert.AreEqual(2, e.CountClumps(new int[] { 1, 2, 2, 3, 4, 4 }));
            Assert.AreEqual(2, e.CountClumps(new int[] { 1, 1, 2, 1, 1 }));
            Assert.AreEqual(1, e.CountClumps(new int[] { 1, 1, 1, 1, 1 }));
            Assert.AreEqual(0, e.CountClumps(new int[] { 1, 2, 3 }));
            Assert.AreEqual(4, e.CountClumps(new int[] { 2, 2, 1, 1, 1, 2, 1, 1, 2, 2 }));
            Assert.AreEqual(4, e.CountClumps(new int[] { 0, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2 }));
            Assert.AreEqual(5, e.CountClumps(new int[] { 0, 0, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2 }));
            Assert.AreEqual(0, e.CountClumps(new int[] { }));
        }