Exemplo n.º 1
0
        void test_RouteSegmentLenVariantPts()
        {
            Prepare.ReloadGlobalSydb(".//input//RouteLength_fromTestLine.xml");
            Dictionary <int, int[]> routes = new Dictionary <int, int[]>()
            {
                //id                //ptnum     //length
                { 234, new int[] { 13, 451833 - 393833 + 600100 - 592163 + 611317 - 606247 + 4000 + 626856 - 611317 + 632996 - 626856 + 961697 - 632996 } },
                { 233, new int[] { 8, 451833 - 393833 + 600100 - 592163 + 611317 - 606247 + 4000 + 626856 - 611317 + 632996 - 626856 + 641374 - 632996 } },
                { 50, new int[] { 5, 451833 - 446833 + 604100 - 592163 + 641374 - 605177 } },
                { 400, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 401, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 402, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 403, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 404, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 405, new int[] { 0, 1197376 - 1115639 + 240000 } },
                { 445, new int[] { 2, 1035200 - 1000000 } },
                { 61, new int[] { 2, 613473 - 842 - 485281 } },
                { 66, new int[] { 2, 613473 - 842 - 485281 } },
            };

            Dictionary <string, string[]> pts = new Dictionary <string, string[]>()
            {
                //NAME                       //ORIEN
                { "P02D", new string[] { Sys.Divergent } },
                { "P20D", new string[] { Sys.Divergent } },
                { "P08D", new string[] { Sys.Convergent } },
                { "P21D", new string[] { Sys.Convergent } },
                { "P10D", new string[] { Sys.Convergent } },
                { "P14D", new string[] { Sys.Convergent } },
                { "P09D", new string[] { Sys.Divergent } },
                { "P07D", new string[] { Sys.Convergent } },
                { "P01D", new string[] { Sys.Convergent } },
                { "P16D", new string[] { Sys.Divergent } },
                { "P18D", new string[] { Sys.Convergent } },
                { "P02E", new string[] { Sys.Divergent } },
                { "P20E", new string[] { Sys.Convergent } },
                { "P01E", new string[] { Sys.Convergent } },
                { "P08B", new string[] { Sys.Divergent } },
                { "P02B", new string[] { Sys.Convergent } },
                { "P12D", new string[] { Sys.Convergent } },
                { "P06D", new string[] { Sys.Divergent } },
            };

            haschecked = false;
            foreach (var r in sydb.routeInfoList)
            {
                RouteSegment route = new RouteSegment(r);

                if (route.GetPointLstFromBlkLst() == false)
                {
                    haschecked = true;
                }

                foreach (var pt in route.m_PtLst)
                {
                    Debug.Assert(pts[pt.Point.Name][0] == pt.Orientation);
                }

                List <Variant> vlist = new List <Variant>();
                Debug.Assert(route.CalVariants(vlist, false) == true);
                Debug.Assert(vlist.Count == routes[(int)(r.ID)][0] * 2);

                Debug.Assert(route.GetLength() == routes[(int)(r.ID)][1]);
            }

            Debug.Assert(haschecked == true);//if the route of pt more than 10, retur false
        }