示例#1
0
        private TimeSpan runTestCase(testCase test, int count)
        {
            TimeSpan sum = TimeSpan.Zero;

            for (int i = 0; i < count; i++)
            {
                currentGrid = new SudokuGrid();

                System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();


                for (int j = 0; j < test.X.Length; j++)
                {
                    currentGrid.setKnownValue(test.X[j], test.Y[j], test.n[j]);
                }

                if (checkBoxAuto.Checked)
                {
                    timer.Start();
                    currentGrid.solve();                     //TODO: ?call solve after each number to better represent user solve times? Add debug gui Choice?
                    timer.Stop();
                }

                sum += timer.Elapsed;
            }
            refreshDisplay();
            labelDebugInfo.Text = "Elapsed:" + sum.ToString();
            return(sum);
        }
示例#2
0
        public void save(int id, [FromBody] testCase model)
        {
            if (model.steps.Count == 0)
            {
                Response.StatusCode = 500;
                return;
            }
            var testcase = _context.TestCase.FirstOrDefault(t => t.Id == id);

            testcase.Body = model.toBodyString();
            _context.SaveChanges();
        }
示例#3
0
        public IActionResult edit(int id, [FromBody] testCase model)
        {
            var bs     = _context.BlockStep.First(t => t.Id == id);
            var bsAttr = bs.blockAttrs();

            var Paramets = model.getCustomParamet();

            Paramets.merge(bsAttr);

            ViewBag.id   = id;
            ViewBag.name = bs.Name;
            return(PartialView("_build", Paramets));
        }
示例#4
0
        /// <summary>
        /// 新建案例时默认的空案例
        /// </summary>
        /// <returns></returns>
        private string tmpCase()
        {
            var csm = new testCase();

            csm.steps = new List <step>();
            var step = new step();

            csm.steps.Add(step);
            step.name     = "emptyStep";
            step.describe = "起始空节点";
            step.spaceID  = -1;//空sapce
            step.attrs    = new Dictionary <string, string>();
            return(JsonConvert.SerializeObject(csm));
        }
示例#5
0
        public IActionResult readyRun(int id, [FromBody] testCase model)
        {
            //先保存
            save(id, model);

            var pms = model.getCustomParamet();

            if (pms.Count > 0)
            {
                return(PartialView("_readyRun", pms));
            }
            else
            {
                return(Content(""));
            }
        }
示例#6
0
 discoverySink.SendTestCase(testCase);
示例#7
0
        public IActionResult build([FromBody] testCase model)
        {
            var Paramets = model.getCustomParamet();

            return(PartialView("_build", Paramets));
        }