Esempio n. 1
0
 private void PrintTestCaseHeader(TestcaseHeader testcaseHeader)
 {
     for (int i = 0; i < testcaseHeader.Headers.Length; i++)
     {
         dgvDetail.Rows.Add();
         dgvDetail.Rows[i].Cells[(int)DgvDetailRow.No].Value         = testcaseHeader.Headers[i].Serial;
         dgvDetail.Rows[i].Cells[(int)DgvDetailRow.Detail].Value     = "";
         dgvDetail.Rows[i].Cells[(int)DgvDetailRow.InputSize].Value  = testcaseHeader.Headers[i].InputSize + " B";
         dgvDetail.Rows[i].Cells[(int)DgvDetailRow.OutputSize].Value = testcaseHeader.Headers[i].OutputSize + " B";
         dgvDetail.Rows[i].Cells[(int)DgvDetailRow.SampleName].Value = testcaseHeader.Headers[i].Name;
     }
     dgvDetail.CurrentCell = null;
 }
Esempio n. 2
0
        private async Task <TestcaseHeader> GetTestcaseHeaderAsync()
        {
            testcaseHeader = new TestcaseHeader();
            if (isSample)
            {
                samples = await HttpClientManager.ExecuteGetJsonAsync <Sample[]>(string.Format(FIND_BY_PROBLEM_ID_SAMPLES, probrem.id));

                return(ConvertSamplesToTestcaseHeader());
            }
            else
            {
                return(await HttpClientManager.ExecuteGetJsonAsync <TestcaseHeader>(string.Format(FIND_BY_PROBLEM_ID_TESTCASE_HEADER, probrem.id)));
            }
        }
Esempio n. 3
0
        private async void Execute()
        {
            //初期化
            InitForm();

            //ヘッダー情報取得
            if (testcaseHeader == null)
            {
                testcaseHeader = await GetTestcaseHeaderAsync();
            }
            PrintTestCaseHeader(testcaseHeader);
            results = new Result[testcaseHeader.Headers.Length];

            //コンパイル
            if (!CompileTarget())
            {
                return;
            }

            var startInfo = new ProcessStartInfo(TEST_TARGET_FILENAME)
            {
                WorkingDirectory       = Environment.CurrentDirectory,
                RedirectStandardInput  = true,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                UseShellExecute        = false,
                CreateNoWindow         = true,
            };

            testcases = new Testcase[testcaseHeader.Headers.Length];
            for (int i = 0; i < testcaseHeader.Headers.Length; i++)
            {
                testcases[i] = await GetTestcaseAsync(i, testcaseHeader.Headers[i].Serial);

                results[i] = ExecTest(startInfo, testcases[i]);
                PrintDgvDetail(i, results[i]);
                if (results[i].Status != "AC")
                {
                    break;
                }
            }

            //結果表示
            PrintDgvResult();
        }
Esempio n. 4
0
        private TestcaseHeader ConvertSamplesToTestcaseHeader()
        {
            TestcaseHeader tmp = new TestcaseHeader
            {
                ProblemId = samples[0].ProblemId,
                Headers   = new TestcaseHeader.Info[samples.Length]
            };

            for (int i = 0; i < samples.Length; i++)
            {
                tmp.Headers[i] = new TestcaseHeader.Info
                {
                    Serial     = samples[i].Serial,
                    Name       = string.Format("samples_{0}", samples[i].Serial.ToString("00")),
                    InputSize  = Encoding.GetEncoding("Shift_JIS").GetByteCount(samples[i].In),
                    OutputSize = Encoding.GetEncoding("Shift_JIS").GetByteCount(samples[i].Out),
                    Score      = -1
                };
            }
            return(tmp);
        }