public void Test6thPrime()
        {
            var task  = new Task7();
            int count = 6;

            Assert.AreEqual(13, task.Run(count), $"{count}'s prime number is incorrect");
        }
        public void Test10001stPrime()
        {
            var task  = new Task7();
            int count = 10001;

            Assert.AreEqual(104743, task.Run(count), $"{count}'s prime number is incorrect");
        }
 static void Main(string[] args)
 {
     Task7.ExecuteTask();
     Task8.ExecuteTask();
     Task10.ExecuteTask();
     Task11.ExecuteTask();
     Task12.ExecuteTask();
 }
        public void Test4()
        {
            var result = Task7.IsSalePossible(0, 10);

            if (result)
            {
                Assert.Fail();
            }
        }
        public void Test6()
        {
            var result = Task7.IsSalePossible(5, 150);

            if (!result)
            {
                Assert.Fail();
            }
        }
        public void Test8()
        {
            var result = Task7.IsSalePossible(6, 501);

            if (result)
            {
                Assert.Fail();
            }
        }
        public void Test3()
        {
            var result = Task7.IsSalePossible(1, 200);

            if (!result)
            {
                Assert.Fail();
            }
        }
        public void Test2()
        {
            var result = Task7.GetSumStock();

            if (result != 6500)
            {
                Assert.Fail();
            }
        }
Exemple #9
0
        public void RunAmplifierLoop_ValueTest(string input, int result)
        {
            var stringArray = input.Split(",");

            stringArray.ShouldNotBeNull();
            var intArray = Array.ConvertAll(stringArray, int.Parse);

            intArray.ShouldNotBeNull();

            Task7.RunAmplifierLoop(intArray).ShouldBe(result);
        }
Exemple #10
0
 /// <summary>
 /// The main.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 private static void Main(string[] args)
 {
     Task1.Execute();
     Task2.Execute();
     Task3.Execute();
     Task4.Execute();
     Task5.Execute();
     Task6.Execute();
     Task7.Execute();
     Task8.Execute();
     Task9.Execute();
     Task10.Execute();
 }
        public void Test1()
        {
            var           result     = Task7.GetProductsOutOfStock();
            List <string> matchNames = new List <string>()
            {
                "Product0", "Product4", "Product8", "Product12", "Product16",
            };

            if (matchNames.Except(result).Any() || result.Except(matchNames).Any())
            {
                Assert.Fail();
            }
        }
 /// <summary>
 /// The main.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 private static void Main(string[] args)
 {
     Task2.ExtractArtists(FileName);
     Task3.ExtractArtistsXPath(FileName);
     Task4.DeleteAllAlbumsWithPriceMoreThan20(FileName);
     Task5.ExtractAllSongTitles(FileName);
     Task6.ExtractAllSongTitlesXpathLinq(FileName);
     Task7.CreateXmlFromTxtFile(TxtName);
     Task8.CreateAlbumXml(FileName);
     Task9.TraverseDirectory("../..");
     Task10.TraverseDirectory("../..");
     Task11.ExtractAlbumPrices(FileName);
     Task12.ExtractAlbumPricesLinq(FileName);
     Task14.ConvertXmlToXsl(FileName, XslName);
     Task16.GenerateXsdFile(FileName);
 }
    // Start is called before the first frame update
    void Awake()
    {
        SelectorNode root = new SelectorNode();

        SequenceNode seq1  = new SequenceNode();
        Task1        task1 = new Task1(sc, pl);
        Task2        task2 = new Task2(sc, pl);

        seq1.addChild(task1);
        seq1.addChild(task2);

        SequenceNode seq2  = new SequenceNode();
        Task3        task3 = new Task3(sc, osc);
        Task4        task4 = new Task4(sc, osc);

        seq2.addChild(task3);
        seq2.addChild(task4);

        SelectorNode sel2  = new SelectorNode();
        SequenceNode seq3  = new SequenceNode();
        Task5        task5 = new Task5(sc);
        Task6        task6 = new Task6(sc);

        seq3.addChild(task5);
        seq3.addChild(task6);
        Task7 task7 = new Task7(sc);

        sel2.addChild(seq3);
        sel2.addChild(task7);

        root.addChild(seq1);
        root.addChild(seq2);
        root.addChild(sel2);

        behavior = new BehaviorTree(root);

        sc.SetDestination(sc.transform.position);
    }
Exemple #14
0
 public static void TaskN7()
 {
     Task7.ValuesFromAToB();
 }
Exemple #15
0
        public static void Main(string[] args)
        {
            Console.Write("Please select the task(1-11): ");
            int taskNumber;

            while (true)
            {
                try
                {
                    taskNumber = int.Parse(Console.ReadLine());
                    if (taskNumber < 1 || taskNumber > 12)
                    {
                        throw new FormatException();
                    }
                    break;
                }
                catch (FormatException)
                {
                    Console.Write("Incorrect input, try again: ");
                }
            }
            switch (taskNumber)
            {
            case 1:
                Task1.Do();
                Program.Main(args);
                break;

            case 2:
                Task2.Do();
                Program.Main(args);
                break;

            case 3:
                Task3.Do();
                Program.Main(args);
                break;

            case 4:
                Task4.Do();
                Program.Main(args);
                break;

            case 5:
                Task5.Do();
                Program.Main(args);
                break;

            case 6:
                Task6.Do();
                Program.Main(args);
                break;

            case 7:
                Task7.Do();
                Program.Main(args);
                break;

            case 8:
                Task8.Do();
                Program.Main(args);
                break;

            case 9:
                Task9.Do();
                Program.Main(args);
                break;

            case 10:
                Task10.Do();
                Program.Main(args);
                break;
            }
        }
Exemple #16
0
        public void CountOfOddElementsTest(int[] array, int expected)
        {
            int actual = Task7.CountOfOddElements(array);

            Assert.AreEqual(expected, actual);
        }
Exemple #17
0
        public void FindNodByEvklidTest(int a, int b, int expected)
        {
            int actual = Task7.FindNodByEvklid(a, b);

            Assert.AreEqual(expected, actual);
        }
Exemple #18
0
    public static void Main()
    {
        /*----------1 задание------------------*/
        string input = "154216";
        Lexer  L     = new IntLexer(input);

        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "5.9";
        L     = new IntLexer(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------2 задание------------------*/
        input = "hggasasa";
        L     = new Task2(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "23hggasasa";
        L     = new Task2(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------3 задание------------------*/
        input = "-9976";
        L     = new Task3(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "09976";
        L     = new Task3(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------4 задание------------------*/
        input = "d4f5g6h7j8";
        L     = new Task4(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "78d4f5";
        L     = new Task4(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------5 задание------------------*/
        input = "d;u;b,j";
        L     = new Task5(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "dd;u;b,j";
        L     = new Task5(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------6 задание------------------*/
        input = "2 4 5 6";
        L     = new Task6(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "2 4      57 6";
        L     = new Task6(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }


        /*----------7 задание------------------*/
        input = "aa11b12cc";
        L     = new Task7(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "aaa11b124cc";
        L     = new Task7(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }


        /*----------8 задание------------------*/
        input = "3.1456";
        L     = new Task8(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "3.14.56";
        L     = new Task8(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "31456.";
        L     = new Task8(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = ".31456";
        L     = new Task8(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------9 задание------------------*/
        input = "'jijijij'";
        L     = new Task9(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "jijijij'";
        L     = new Task9(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "'jijijij";
        L     = new Task9(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        /*----------10 задание------------------*/
        input = "/*789876*/";
        L     = new Task10(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "/*";
        L     = new Task10(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        input = "/*89";
        L     = new Task10(input);
        try
        {
            L.Parse();
        }
        catch (LexerException e)
        {
            System.Console.WriteLine(e.Message);
        }

        Console.ReadKey();
    }
Exemple #19
0
        static void Main(string[] args)
        {
            string someText   = "sometext444is777here";
            string textWithIp = "My IP is 185.219.78.170 !";

            string digits          = someText.ExtractDigits();
            string letters         = someText.ExtractLetters();
            string textAfterSymbol = someText.ExtractTextAfterSymbol("x");
            string ip = textWithIp.ExtractIp();

            FileActions file = new FileActions();

            file.CreateWriteFile(textWithIp);
            string fileText   = file.ReadFromFIle();
            string ipFromFile = fileText.ExtractIp();

            file.DeleteFile();

            Task1 task1 = new Task1();

            task1.AssignDifferentValues();
            task1.DontAssignValues();
            task1.AssignSameValues();
            task1.SameValuesFloadDouble();
            task1.DivideByZero();
            task1.DivideByThree();
            task1.DivideByThreeAndRound();

            Task2 task2 = new Task2();

            task2.CompareBoolAndPrint(); //how to use 'case' here?
            task2.CompareDifferentNumericValues();
            task2.LogicalANDandOR();
            task2.DifferentStrings();

            Task3 task3 = new Task3();

            task3.SimpleCycles();
            task3.TenTimesLoop();
            int factorial = task3.RecursionWithExitCondition(3);
            //task3.InfiniteLoop();
            //task3.RecursionWithoutExitCondition(4);

            Task4 task4 = new Task4();

            task4.MyList();
            task4.MyDictionary();
            task4.MyTuple();

            Task5 task5 = new Task5();

            task5.ListGet();
            task5.ListAdd();
            task5.ListRemove();
            task5.PrintNewList();

            Task6 task6 = new Task6();

            task6.DivideByZero();

            Task7 task7 = new Task7();

            task7.CreateWriteFile();
            task7.MathOperationsOnNumbersFromString();

            Task8_Serialization2 task8 = new Task8_Serialization2();

            task8.Serialize();  //how to serialize a class, not an object? how to print serialized object?

            Task9 task9 = new Task9();

            task9.ParseToJson();

            Task10 task10 = new Task10();

            task10.PrintConcatenatedStrings();
            task10.TrimString();
            task10.PrintWordsInSeparateRow();
            task10.CleanEmptySpaces();
            task10.ToUppercase();
            task10.AllWToUppercase();
            task10.FirstWToUppercase();
            task10.ParsePrice();
        }
Exemple #20
0
 public static string GetAuthorNamesEndingIn(BookShopContext context, string command)
 {
     return(Task7.GetResult(context, command));
 }