Пример #1
0
        public void TestSimple()
        {
            var expected = new int[] { 20, 37, 21 };

            var actual = KataClass.DeleteNth(new int[] { 20, 37, 20, 21 }, 1);

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #2
0
        public void TestSimple2()
        {
            var expected = new int[] { 1, 1, 3, 3, 7, 2, 2, 2 };

            var actual = KataClass.DeleteNth(new int[] { 1, 1, 3, 3, 7, 2, 2, 2, 2 }, 3);

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #3
0
 public void HumanReadableTest()
 {
     Assert.AreEqual("00:00:00", KataClass.GetReadableTime(0));
     Assert.AreEqual("00:00:05", KataClass.GetReadableTime(5));
     Assert.AreEqual("00:01:00", KataClass.GetReadableTime(60));
     Assert.AreEqual("23:59:59", KataClass.GetReadableTime(86399));
     Assert.AreEqual("99:59:59", KataClass.GetReadableTime(359999));
 }
Пример #4
0
 public void Test1()
 {
     Assert.AreEqual(21, KataClass.NextBiggerNumber(12));
     Assert.AreEqual(531, KataClass.NextBiggerNumber(513));
     Assert.AreEqual(2071, KataClass.NextBiggerNumber(2017));
     Assert.AreEqual(441, KataClass.NextBiggerNumber(414));
     Assert.AreEqual(414, KataClass.NextBiggerNumber(144));
     Assert.AreEqual(1754102208, KataClass.NextBiggerNumber(1754102082));
 }
Пример #5
0
 public void EasyHamsters()
 {
     Assert.AreEqual("h1a1m1s1t1e1r1", KataClass.HamsterMe("hamster", "hamster"));
     Assert.AreEqual("h1e1h5m4m1e1", KataClass.HamsterMe("hamster", "helpme"));
     Assert.AreEqual("h1t8m1s1t1e1r1", KataClass.HamsterMe("hmster", "hamster"));
     Assert.AreEqual("h1a1m1s1t1e1r1", KataClass.HamsterMe("hhhhammmstteree", "hamster"));
     Assert.AreEqual("a1a2a3a4e1e2e3h1h2h3h4h5m1m2m3m4m5r1s1t1t2t3t4t5t6t7", KataClass.HamsterMe("hamster", "abcdefghijklmnopqrstuvwxyz"));
     Assert.AreEqual("f22f23f24f25f26f1f2f3f4f5f6f7f8f9f10f11f12f13f14f15f16f17f18f19f20f21", KataClass.HamsterMe("f", "abcdefghijklmnopqrstuvwxyz"));
 }
Пример #6
0
        public void TestDictionaryCreation()
        {
            //given
            var result = KataClass.CreateHamsterEncryptionDictionary("hamster");

            Assert.AreEqual("a1", result['a']);
            Assert.AreEqual("t7", result['z']);
            Assert.AreEqual("s1", result['s']);
            Assert.AreEqual("e2", result['f']);
        }
Пример #7
0
 public static void test1()
 {
     testing(KataClass.Scramble("rkqodlw", "world"), true);
     testing(KataClass.Scramble("cedewaraaossoqqyt", "codewars"), true);
     testing(KataClass.Scramble("katas", "steak"), false);
     testing(KataClass.Scramble("scriptjavx", "javascript"), false);
     testing(KataClass.Scramble("scriptingjava", "javascript"), true);
     testing(KataClass.Scramble("scriptsjava", "javascripts"), true);
     testing(KataClass.Scramble("javscripts", "javascript"), false);
     testing(KataClass.Scramble("aabbcamaomsccdd", "commas"), true);
     testing(KataClass.Scramble("commas", "commas"), true);
     testing(KataClass.Scramble("sammoc", "commas"), true);
 }
Пример #8
0
 public void Test1()
 {
     Assert.AreEqual("ROT13 example.", KataClass.Rot13("EBG13 rknzcyr."));
 }
Пример #9
0
 public void TestExample()
 {
     Assert.AreEqual("11", KataClass.AddBinary(1, 2), "Should return \"11\" for 1 + 2");
 }
Пример #10
0
 public void ExampleTests()
 {
     Assert.AreEqual('e', KataClass.FindMissingLetter(new[] { 'a', 'b', 'c', 'd', 'f' }));
     Assert.AreEqual('P', KataClass.FindMissingLetter(new[] { 'O', 'Q', 'R', 'S' }));
 }
Пример #11
0
 public void Test2()
 {
     Assert.AreEqual(new BigInteger(216), KataClass.perimeter(new BigInteger(7)));
 }
Пример #12
0
 public void Test1()
 {
     Assert.AreEqual(new BigInteger(80), KataClass.perimeter(new BigInteger(5)));
 }
Пример #13
0
        public void Test1()
        {
            int lst = 7775460;

            Assert.AreEqual("(2**2)(3**3)(5)(7)(11**2)(17)", KataClass.factors(lst));
        }
Пример #14
0
 public void ASimpleKataTest()
 {
     Assert.AreEqual("110", KataClass.Add("91", "19"));
     Assert.AreEqual("1111111111", KataClass.Add("123456789", "987654322"));
     Assert.AreEqual("16152487201288156", KataClass.Add("7425963542589632", "8726523658698524"));
 }