Ejemplo n.º 1
0
        public void Variation_Without_Repetitions_Smoke_Test()
        {
            var input      = "".ToCharArray().ToList();
            var variations = Variation.Find <char>(input, 2, false);

            Assert.AreEqual(combination(input.Count, 2) * factorial(2), variations.Count);

            input      = "cookie".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, false);
            Assert.AreEqual(combination(input.Count, 3) * factorial(3), variations.Count);

            input      = "monsters".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, false);
            Assert.AreEqual(combination(input.Count, 3) * factorial(3), variations.Count);
        }
Ejemplo n.º 2
0
        public void Variation_With_Repetitions_Smoke_Test()
        {
            var input      = "abcd".ToCharArray().ToList();
            var variations = Variation.Find <char>(input, 2, true);

            Assert.AreEqual(combination(input.Count + 2 - 1, 2) * factorial(2), variations.Count);

            input      = "scan".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, true);
            Assert.AreEqual(combination(input.Count + 3 - 1, 3) * factorial(3), variations.Count);

            input      = "".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, true);
            Assert.AreEqual(0, variations.Count);
        }
Ejemplo n.º 3
0
        public void Variation_With_Repetitions_Smoke_Test()
        {
            var input      = "abcd".ToCharArray().ToList();
            var variations = Variation.Find <char>(input, 2, true);

            Assert.AreEqual(Math.Pow(input.Count, 2), variations.Count);

            input      = "scan".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, true);
            Assert.AreEqual(Math.Pow(input.Count, 3), variations.Count);

            input      = "".ToCharArray().ToList();
            variations = Variation.Find <char>(input, 3, true);
            Assert.AreEqual(0, variations.Count);
        }