public TrinomialTree(StochasticProcess1D process,
                             TimeGrid timeGrid,
                             bool isPositive /*= false*/)
            : base(timeGrid.size())
        {
            branchings_ = new List <Branching>();
            dx_         = new InitializedList <double>(1);
            timeGrid_   = timeGrid;
            x0_         = process.x0();

            int nTimeSteps = timeGrid.size() - 1;
            int jMin       = 0;
            int jMax       = 0;

            for (int i = 0; i < nTimeSteps; i++)
            {
                double t  = timeGrid[i];
                double dt = timeGrid.dt(i);

                //Variance must be independent of x
                double v2 = process.variance(t, 0.0, dt);
                double v  = Math.Sqrt(v2);
                dx_.Add(v * Math.Sqrt(3.0));

                Branching branching = new Branching();
                for (int j = jMin; j <= jMax; j++)
                {
                    double x    = x0_ + j * dx_[i];
                    double m    = process.expectation(t, x, dt);
                    int    temp = (int)(Math.Floor((m - x0_) / dx_[i + 1] + 0.5));

                    if (isPositive)
                    {
                        while (x0_ + (temp - 1) * dx_[i + 1] <= 0)
                        {
                            temp++;
                        }
                    }

                    double e  = m - (x0_ + temp * dx_[i + 1]);
                    double e2 = e * e;
                    double e3 = e * Math.Sqrt(3.0);

                    double p1 = (1.0 + e2 / v2 - e3 / v) / 6.0;
                    double p2 = (2.0 - e2 / v2) / 3.0;
                    double p3 = (1.0 + e2 / v2 + e3 / v) / 6.0;

                    branching.add(temp, p1, p2, p3);
                }
                branchings_.Add(branching);

                jMin = branching.jMin();
                jMax = branching.jMax();
            }
        }
Exemplo n.º 2
0
        public void SortTests(int a, int b, int c, int expectedA, int expectedB, int expectedC)
        {
            Branching.Sort(ref a, ref b, ref c);
            int actualA = a;
            int actualB = b;
            int actualC = c;

            Assert.AreEqual(expectedA, actualA);
            Assert.AreEqual(expectedB, actualB);
            Assert.AreEqual(expectedC, actualC);
        }
Exemplo n.º 3
0
        public void SortIncrease_WhenABCPassed_ShouldSortIncrease(int a, int b, int c, int expectedA, int expectedB, int expectedC)
        {
            Branching.SortIncrease(ref a, ref b, ref c);

            int actualA = a;
            int actualB = b;
            int actualC = c;

            Assert.AreEqual(expectedA, actualA);
            Assert.AreEqual(expectedB, actualB);
            Assert.AreEqual(expectedC, actualC);
        }
Exemplo n.º 4
0
        public void ApplyTest()
        {
            object[,] data =
            {
                { "Id", "IsSmoker", "Age" },
                {    0,          1,    10 },
                {    1,          1,    15 },
                {    2,          0,    40 },
                {    3,          1,    20 },
                {    4,          0,    70 },
                {    5,          0,    55 },
            };

            DataTable input = data.ToTable();

            var smoker = new LinearScaling();
            var common = new LinearScaling();

            smoker.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(10, 20),
                OutputRange = new DoubleRange(-1, 0)
            });

            common.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(40, 70),
                OutputRange = new DoubleRange(0, 1)
            });


            var settings = new Branching.Options("IsSmoker");

            settings.Filters.Add(1, smoker);
            settings.Filters.Add(0, common);

            Branching branching = new Branching(settings);



            DataTable actual = branching.Apply(input);

            double[] expected = { -1, -0.5, 0, 0, 1, 0.5 };

            foreach (DataRow row in actual.Rows)
            {
                int    id  = (int)row[0];
                double age = (double)row[2];
                Assert.AreEqual(expected[id], age);
            }
        }
Exemplo n.º 5
0
        public void SortAscendingOrder3Test(int x, int y, int z, int[] expected)
        {
            int[] actual = Branching.SortAscendingOrder3(x, y, z);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void GetQuadraticDiscriminantTests(double a, double b, double c, double expected)
        {
            double actual = Branching.GetQuadraticDiscriminant(a, b, c);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 7
0
        public void WhichQuarterBelongs2Test(int x, int y, int expected)
        {
            int actual = Branching.WhichQuarterBelongs2(x, y);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
 public void GetPointQuarterNegativeTests(int x, int y)
 {
     Assert.Throws <ArgumentException>(() => Branching.GetPointQuarter(x, y));
 }
Exemplo n.º 9
0
        public void CalculationAAndB_WhenABPassed_ShouldSumMultiplication(int a, int b, int expected)
        {
            int actual = Branching.CalculationAAndB(a, b);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 10
0
        public void GetSolveToQuadraticEquation_WhenABCPassed_ShouldResult(double a, double b, double c, string expected)
        {
            string actual = Branching.GetSolveToQuadraticEquation(a, b, c);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 11
0
        void handleMsg(KBEngine.Packet packet)
        {
            var receivePkg = packet.protoBody.GetType().FullName;

            Debug.Log("Server Receive " + receivePkg);
            var          className   = receivePkg.Split(char.Parse(".")) [1];
            IBuilderLite retPb       = null;
            uint         flowId      = packet.flowId;
            bool         findHandler = false;

            if (className == "CGAutoRegisterAccount")
            {
                var au = GCAutoRegisterAccount.CreateBuilder();
                au.Username = "******";
                retPb       = au;
            }
            else if (className == "CGRegisterAccount")
            {
                var au = GCRegisterAccount.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGLoginAccount")
            {
                var au         = GCLoginAccount.CreateBuilder();
                var playerInfo = ServerData.Instance.playerInfo;
                if (playerInfo.HasRoles)
                {
                    var role = RolesInfo.CreateBuilder().MergeFrom(playerInfo.Roles);
                    au.AddRolesInfos(role);
                }

                retPb = au;
            }
            else if (className == "CGSelectCharacter")
            {
                var inpb = packet.protoBody as CGSelectCharacter;
                if (inpb.PlayerId == 101)
                {
                    selectPlayerJob = 4;
                }
                else if (inpb.PlayerId == 102)
                {
                    selectPlayerJob = 2;
                }
                else
                {
                    selectPlayerJob = 1;
                }
                var au = GCSelectCharacter.CreateBuilder();
                au.TokenId = "12345";
                retPb      = au;
            }
            else if (className == "CGBindingSession")
            {
                var au = GCBindingSession.CreateBuilder();
                au.X             = 22;
                au.Y             = 1;
                au.Z             = 17;
                au.Direction     = 10;
                au.MapId         = 0;
                au.DungeonBaseId = 0;
                au.DungeonId     = 0;
                retPb            = au;
            }
            else if (className == "CGEnterScene")
            {
                var inpb = packet.protoBody as CGEnterScene;
                var au   = GCEnterScene.CreateBuilder();
                au.Id = inpb.Id;
                retPb = au;
            }
            else if (className == "CGListBranchinges")
            {
                var au   = GCListBranchinges.CreateBuilder();
                var bran = Branching.CreateBuilder();
                bran.Line        = 1;
                bran.PlayerCount = 2;
                au.AddBranching(bran);
                retPb = au;
            }
            else if (className == "CGHeartBeat")
            {
            }
            else if (className == "CGLoadSaleItems")
            {
                var au = GCLoadSaleItems.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGListAllTeams")
            {
                var au = GCListAllTeams.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGCopyInfo")
            {
                var pinfo = ServerData.Instance.playerInfo;
                if (pinfo.HasCopyInfos)
                {
                    retPb = GCCopyInfo.CreateBuilder().MergeFrom(pinfo.CopyInfos);
                }
                else
                {
                    //First Fetch Login Info
                    var au  = GCCopyInfo.CreateBuilder();
                    var cin = CopyInfo.CreateBuilder();
                    cin.Id     = 101;
                    cin.IsPass = false;
                    au.AddCopyInfo(cin);
                    var msg = au.Build();
                    pinfo.CopyInfos = msg;
                    retPb           = GCCopyInfo.CreateBuilder().MergeFrom(msg);
                }
            }
            else if (className == "CGLoadVipLevelGiftReceiveInfo")
            {
                var au  = GCLoadVipLevelGiftReceiveInfo.CreateBuilder();
                var vip = ReceviedReward.CreateBuilder();
                vip.RewardId = 1;
                au.AddReceviedLevelRewards(vip);

                vip          = ReceviedReward.CreateBuilder();
                vip.RewardId = 2;
                au.AddReceviedLevelRewards(vip);

                vip          = ReceviedReward.CreateBuilder();
                vip.RewardId = 3;
                au.AddReceviedLevelRewards(vip);

                retPb = au;
            }
            else if (className == "CGLoadVipInfo")
            {
                var au = GCLoadVipInfo.CreateBuilder();
                au.VipType       = VipType.NONE_VIP;
                au.VipRemainTime = 0;
                au.VipLevel      = 4;
                au.VipExp        = 0;
                retPb            = au;
            }
            else if (className == "CGLoadTaskList")
            {
                var au   = GCLoadTaskList.CreateBuilder();
                var task = PlayerTask.CreateBuilder();
                task.TaskId       = 1;
                task.PlayerTaskId = 1;
                task.PlayerId     = 2;
                task.TaskState    = 5;
                task.Chain        = 6;
                au.AddPlayerTask(task);

                task              = PlayerTask.CreateBuilder();
                task.TaskId       = 2;
                task.PlayerTaskId = 1;
                task.PlayerId     = 2;
                task.TaskState    = 5;
                task.Chain        = 6;
                au.AddPlayerTask(task);

                task              = PlayerTask.CreateBuilder();
                task.TaskId       = 3;
                task.PlayerTaskId = 1;
                task.PlayerId     = 2;
                task.TaskState    = 5;
                task.Chain        = 6;
                au.AddPlayerTask(task);

                retPb = au;
            }
            else if (className == "CGLoadAchievements")
            {
                var au = GCLoadAchievements.CreateBuilder();
                var ac = Achievement.CreateBuilder();
                ac.AchievementId = 1000;
                au.AddAchievements(ac);

                ac = Achievement.CreateBuilder();
                ac.AchievementId = 1001;
                au.AddAchievements(ac);

                ac = Achievement.CreateBuilder();
                ac.AchievementId = 1002;
                au.AddAchievements(ac);

                ac = Achievement.CreateBuilder();
                ac.AchievementId = 1003;
                au.AddAchievements(ac);

                ac = Achievement.CreateBuilder();
                ac.AchievementId = 1004;
                au.AddAchievements(ac);
                retPb = au;
            }
            else if (className == "CGAuctionInfo")
            {
                var au = GCAuctionInfo.CreateBuilder();
                au.MaxSize  = 1;
                au.PageSize = 6;
                var item = AuctionItem.CreateBuilder();
                item.Id         = 11;
                item.BaseId     = 14;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 60;
                item.TotalCost  = 88;
                au.AddAuctionItems(item);

                item            = AuctionItem.CreateBuilder();
                item.Id         = 119;
                item.BaseId     = 15;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 609;
                item.TotalCost  = 889;
                au.AddAuctionItems(item);

                item            = AuctionItem.CreateBuilder();
                item.Id         = 118;
                item.BaseId     = 16;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 608;
                item.TotalCost  = 888;
                au.AddAuctionItems(item);

                item            = AuctionItem.CreateBuilder();
                item.Id         = 117;
                item.BaseId     = 23;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 607;
                item.TotalCost  = 887;
                au.AddAuctionItems(item);

                item            = AuctionItem.CreateBuilder();
                item.Id         = 116;
                item.BaseId     = 24;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 605;
                item.TotalCost  = 886;
                au.AddAuctionItems(item);

                item            = AuctionItem.CreateBuilder();
                item.Id         = 115;
                item.BaseId     = 25;
                item.Type       = 1;
                item.SellCount  = 2;
                item.RemainTime = 605;
                item.TotalCost  = 88;
                au.AddAuctionItems(item);
                retPb = au;
            }
            else if (className == "CGUserDressEquip")
            {
                PlayerData.UserDressEquip(packet);
                findHandler = true;
            }
            else if (className == "CGAutoRegisterAccount")
            {
                var au = GCAutoRegisterAccount.CreateBuilder();
                au.Username = "******" + random.Next();
                retPb       = au;
            }
            else if (className == "CGRegisterAccount")
            {
                var inpb = packet.protoBody as CGRegisterAccount;
                ServerData.Instance.playerInfo.Username = inpb.Username;

                var au = GCRegisterAccount.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGPlayerMove")
            {
                var au = GCPlayerMove.CreateBuilder();
                retPb = au;
            }
            else
            {
                var fullName    = packet.protoBody.GetType().FullName;
                var handlerName = fullName.Replace("ChuMeng", "ServerPacketHandler");

                var tp = Type.GetType(handlerName);
                if (tp == null)
                {
                    if (ServerPacketHandler.HoldCode.staticTypeMap.ContainsKey(handlerName))
                    {
                        tp = ServerPacketHandler.HoldCode.staticTypeMap [handlerName];
                    }
                }

                if (tp == null)
                {
                    Debug.LogError("PushMessage noHandler " + handlerName);
                }
                else
                {
                    findHandler = true;
                    var ph = (ServerPacketHandler.IPacketHandler)Activator.CreateInstance(tp);
                    ph.HandlePacket(packet);
                }
            }


            if (retPb != null)
            {
                SendPacket(retPb, flowId);
            }
            else
            {
                if (className != "CGHeartBeat" && !findHandler)
                {
                    Debug.LogError("DemoServer::not Handle Message " + className);
                }
            }
        }
Exemplo n.º 12
0
        public void ApplyTest()
        {
            object[,] data = 
            {
                { "Id", "IsSmoker", "Age" },
                {   0,       1,        10  },
                {   1,       1,        15  },
                {   2,       0,        40  },
                {   3,       1,        20  },
                {   4,       0,        70  },
                {   5,       0,        55  },
            };

            DataTable input = data.ToTable();

            var smoker = new LinearScaling();
            var common = new LinearScaling();

            smoker.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(10, 20),
                OutputRange = new DoubleRange(-1, 0)
            });

            common.Columns.Add(new LinearScaling.Options("Age")
            {
                SourceRange = new DoubleRange(40, 70),
                OutputRange = new DoubleRange(0, 1)
            });


            var settings = new Branching.Options("IsSmoker");
            settings.Filters.Add(1, smoker);
            settings.Filters.Add(0, common);

            Branching branching = new Branching(settings);



            DataTable actual = branching.Apply(input);

            double[] expected = { -1, -0.5, 0, 0, 1, 0.5 };

            foreach (DataRow row in actual.Rows)
            {
                int id = (int)row[0];
                double age = (double)row[2];
                Assert.AreEqual(expected[id], age);
            }

        }
Exemplo n.º 13
0
 public void GetRootsSquareEquation_WhenABCPassed_ShouldDivideByZeroException(double a, double b, double c)
 {
     Assert.Throws <DivideByZeroException>(() => Branching.GetRootsSquareEquation(a, b, c));
 }
Exemplo n.º 14
0
        public void GetUppercaseNumbers_WhenAPassed_ShouldNumberInWords(int number, string expected)
        {
            string actual = Branching.GetUppercaseNumbers(number);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 15
0
        public void GetRootsSquareEquation_WhenABCPassed_ShouldRootsSquareEquation(double a, double b, double c, double[] expected)
        {
            double[] actual = Branching.GetRootsSquareEquation(a, b, c);

            Assert.That(actual, Is.EqualTo(expected).Within(3));
        }
Exemplo n.º 16
0
        public void SolutionQuadraticEquation4(int x, int y, int z, double[] expected)
        {
            double[] actual = Branching.SolutionQuadraticEquation4(x, y, z);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 17
0
        public void GetQuarter_WhenABPassed_GetQuarter(int a, int b, int expected)
        {
            int actual = Branching.GetQuarter(a, b);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 18
0
 public void GetQuadraticDiscriminantNegativeTests(double a, double b, double c)
 {
     Assert.Throws <ArgumentException>(() => Branching.GetQuadraticDiscriminant(a, b, c));
 }
Exemplo n.º 19
0
        void handleMsg(KBEngine.Packet packet)
        {
            var receivePkg = packet.protoBody.GetType().FullName;

            Debug.Log("Server Receive " + receivePkg);
            var          className   = receivePkg.Split(char.Parse(".")) [1];
            IBuilderLite retPb       = null;
            uint         flowId      = packet.flowId;
            bool         findHandler = false;

            if (className == "CGAutoRegisterAccount")
            {
                var au = GCAutoRegisterAccount.CreateBuilder();
                au.Username = "******";
                retPb       = au;
            }
            else if (className == "CGRegisterAccount")
            {
                var au = GCRegisterAccount.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGLoginAccount")
            {
                var au         = GCLoginAccount.CreateBuilder();
                var playerInfo = ServerData.Instance.playerInfo;
                if (playerInfo.HasRoles)
                {
                    var role = RolesInfo.CreateBuilder().MergeFrom(playerInfo.Roles);
                    au.AddRolesInfos(role);
                }

                retPb = au;
            }
            else if (className == "CGSelectCharacter")
            {
                var inpb = packet.protoBody as CGSelectCharacter;
                if (inpb.PlayerId == 101)
                {
                    selectPlayerJob = 4;
                }
                else if (inpb.PlayerId == 102)
                {
                    selectPlayerJob = 2;
                }
                else
                {
                    selectPlayerJob = 1;
                }
                var au = GCSelectCharacter.CreateBuilder();
                au.TokenId = "12345";
                retPb      = au;
            }
            else if (className == "CGBindingSession")
            {
                var au = GCBindingSession.CreateBuilder();
                au.X             = 22;
                au.Y             = 1;
                au.Z             = 17;
                au.Direction     = 10;
                au.MapId         = 0;
                au.DungeonBaseId = 0;
                au.DungeonId     = 0;
                retPb            = au;
            }
            else if (className == "CGEnterScene")
            {
                var inpb = packet.protoBody as CGEnterScene;
                var au   = GCEnterScene.CreateBuilder();
                au.Id = inpb.Id;
                retPb = au;
            }
            else if (className == "CGListBranchinges")
            {
                var au   = GCListBranchinges.CreateBuilder();
                var bran = Branching.CreateBuilder();
                bran.Line        = 1;
                bran.PlayerCount = 2;
                au.AddBranching(bran);
                retPb = au;
            }
            else if (className == "CGHeartBeat")
            {
            }
            else if (className == "CGCopyInfo")
            {
                var pinfo = ServerData.Instance.playerInfo;
                if (pinfo.HasCopyInfos)
                {
                    retPb = GCCopyInfo.CreateBuilder().MergeFrom(pinfo.CopyInfos);
                }
                else
                {
                    //First Fetch Login Info
                    var au  = GCCopyInfo.CreateBuilder();
                    var cin = CopyInfo.CreateBuilder();
                    cin.Id     = 101;
                    cin.IsPass = false;
                    au.AddCopyInfo(cin);
                    var msg = au.Build();
                    pinfo.CopyInfos = msg;
                    retPb           = GCCopyInfo.CreateBuilder().MergeFrom(msg);
                }
            }


            else if (className == "CGUserDressEquip")
            {
                PlayerData.UserDressEquip(packet);
                findHandler = true;
            }
            else if (className == "CGAutoRegisterAccount")
            {
                var au = GCAutoRegisterAccount.CreateBuilder();
                au.Username = "******" + random.Next();
                retPb       = au;
            }
            else if (className == "CGRegisterAccount")
            {
                var inpb = packet.protoBody as CGRegisterAccount;
                ServerData.Instance.playerInfo.Username = inpb.Username;

                var au = GCRegisterAccount.CreateBuilder();
                retPb = au;
            }
            else if (className == "CGPlayerMove")
            {
                var au = GCPlayerMove.CreateBuilder();
                retPb = au;
            }
            else
            {
                var fullName    = packet.protoBody.GetType().FullName;
                var handlerName = fullName.Replace("MyLib", "ServerPacketHandler");

                var tp = Type.GetType(handlerName);
                if (tp == null)
                {
                    if (ServerPacketHandler.HoldCode.staticTypeMap.ContainsKey(handlerName))
                    {
                        tp = ServerPacketHandler.HoldCode.staticTypeMap [handlerName];
                    }
                }

                if (tp == null)
                {
                    Debug.LogError("PushMessage noHandler " + handlerName);
                }
                else
                {
                    findHandler = true;
                    var ph = (ServerPacketHandler.IPacketHandler)Activator.CreateInstance(tp);
                    ph.HandlePacket(packet);
                }
            }


            if (retPb != null)
            {
                SendPacket(retPb, flowId);
            }
            else
            {
                if (className != "CGHeartBeat" && !findHandler)
                {
                    Debug.LogError("DemoServer::not Handle Message " + className);
                }
            }
        }
Exemplo n.º 20
0
 public void GetSquareEquationRootsTests(double a, double b, double c, double[] expected)
 {
     double[] actual = Branching.GetSquareEquationRoots(a, b, c);
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 21
0
        public void DetermineInWhichQuarterPoint_WhenXYPassed_ShouldQuarter(int x, int y, string expected)
        {
            string actual = Branching.DetermineInWhichQuarterPoint(x, y);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 22
0
 public void GetSquareEquationRootsNegativeTests(double a, double b, double c)
 {
     Assert.Throws <ArgumentException>(() => Branching.GetSquareEquationRoots(a, b, c));
 }
Exemplo n.º 23
0
        public void NumbersInWords5Test(int x, string expected)
        {
            string actual = Branching.NumbersInWords5(x);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 24
0
        public void RightTwoDigitNumberInWordsTests(int number, string expected)
        {
            string actual = Branching.RightTwoDigitNumberInWords(number);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 25
0
 public void RightTwoDigitNumberInWordsNegativeTests(int number)
 {
     Assert.Throws <ArgumentException>(() => Branching.RightTwoDigitNumberInWords(number));
 }
Exemplo n.º 26
0
        public void GetSumOrMultiplyOrMinus_WhenABPassed_ShouldResult(double a, double b, double expected)
        {
            double actual = Branching.GetSumOrMultiplyOrMinus(a, b);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 27
0
        public void CalculateTests(double a, double b, double expected)
        {
            double actual = Branching.Calculate(a, b);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 28
0
        public void GetNumbersInAscendingOrder_WhenABPassed_ShouldResult(double a, double b, double c, string expected)
        {
            string actual = Branching.GetNumbersInAscendingOrder(a, b, c);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 29
0
        public void GetPointQuarterTests(int x, int y, int expected)
        {
            double actual = Branching.GetPointQuarter(x, y);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 30
0
        public void PrintInLettersNumber_WhenNumberPassed_ShouldResult(int number, string expected)
        {
            string actual = Branching.PrintInLettersNumber(number);

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 31
0
        public void Task1Test(int x, int y, int expected)
        {
            int actual = Branching.Task1(x, y);

            Assert.AreEqual(expected, actual);
        }