コード例 #1
0
        /// <summary>
        /// Testar dina avancerade kunskaper.
        /// </summary>
        /// <param name="debugX">Vilken kolumn på consolen som texten ska läggas in i</param>
        /// <returns>Procentvärde av resultat.</returns>
        internal static double Avancerad(int debugX = 46)
        {
            const int max   = 15;
            var       score = 0;

            NiceDebug.Reset(debugX);
            var check = new CSRepAvancerad();

            score += VerifyInput(check.LessIsFirst(10, 2), 2, 10);
            score += VerifyInput(check.LessIsFirst(4, 3), 3, 4);
            score += VerifyInput(check.LessIsFirst(12, 22), 12, 22);

            score += VerifyInput(check.Swap("AA", "BB"), "BB", "AA");
            score += VerifyInput(check.Swap("Hej", "Ciao"), "Ciao", "Hej");
            score += VerifyInput(check.Swap("Katt", "Hund"), "Hund", "Katt");

            score += VerifyInput(check.LinQSum(2, 5, 23, 342, 12, 11, 24, 76), 495);
            score += VerifyInput(check.LinQAvg(2, 5, 23, 342, 12, 11, 24, 76), 61.875);

            score += VerifyInput(check.SortText("marcus"), "acmrsu");
            score += VerifyInput(check.SortText("jultomten"), "ejlmnottu");

            score += VerifyInput(check.FindWord(3, "Katt", "Hund", "Ros", "Röd ros", "Jultomte"), "Ros");
            score += VerifyInput(check.FindWord(5, "Elefant", "Tidtabell", "Planering", "Musik", "Spotify"), "Musik");

            score += VerifyInput(check.LinQHiscore(100, 32, 127, 95, 47, 89, 112), 127);
            score += VerifyInput(check.LinQWorstPlayer(100, 32, 127, 95, 47, 89, 112), 32);
            score += VerifyInput(check.IsLeet(100, 1773, 127, 95, 47, 89, 112), true);

            return(Math.Round((double)score / max * 100));
        }
コード例 #2
0
        /// <summary>
        /// Testar dina avancerade kunskaper.
        /// </summary>
        /// <param name="debugX">Debugtext position<see cref="int"/>.</param>
        /// <returns>Procentvärde av resultat.</returns>
        internal static double Avancerad(int debugX = 46)
        {
            const int max   = 11;
            int       score = 0;

            NiceDebug.Reset(debugX);
            CSRepAvancerad check = new CSRepAvancerad();

            score += VerifyInput(check.VarannanBokstav("Katt", "Hund"), "KHautntd");
            score += VerifyInput(check.VarannanBokstav("Nelson", "Mandela"), "NMealnsdoenla");
            score += VerifyInput(check.VarannanBokstav("Sherlock", "Holmes"), "SHhoelrmleosck");

            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2020, 12, 24)), 36);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2021, 12, 24)), 401);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 11), new DateTime(2020, 12, 12)), 31);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2021, 1, 1)), 44);
            score += VerifyInput(check.AntalDagar(new DateTime(2021, 1, 1), new DateTime(2020, 1, 1)), -366);

            score += VerifyInput(check.LäggTillMånad(new DateTime(2020, 11, 18), 5), new DateTime(2021, 4, 18));
            score += VerifyInput(check.LäggTillMånad(new DateTime(2021, 11, 18), 2), new DateTime(2022, 01, 18));
            score += VerifyInput(check.LäggTillMånad(new DateTime(2021, 11, 18), -2), new DateTime(2021, 9, 18));

            return(Math.Round((double)score / max * 100));
        }