public RunningResults(Verdict verdict, string compilationOutput = "", string output = "", string error = "") { Verdict = verdict; CompilationOutput = compilationOutput; Output = output; Error = error; }
public ExecutionResult(Verdict verdict, double running_time = 0, double memory_usage = 0, string error_msg = "") { this.Verdict = verdict; this.ErrorMsg = error_msg; this.MemmoryUsage = memory_usage; this.RunningTime = running_time; }
public void SetPassVerdict() { if (m_verdict == Verdict.Unset) { m_verdict = Verdict.Pass; } }
public void ReportExpectResult(string title, string expected, string actual, Verdict verdict) { string resultDescription; if (String.IsNullOrEmpty(title)) { resultDescription = $"EXPECT: {expected}; Actual: {actual} => {verdict}"; } else { resultDescription = $"EXPECT: {expected}; Actual: {actual} => {verdict}"; } if (verdict == Verdict.Error) { m_loggerInside.LogError(m_currentStatementLine.ToString(), resultDescription); this.ReportError(resultDescription, null, null); } else if (verdict >= Verdict.Fail) { m_loggerInside.LogError(m_currentStatementLine.ToString(), resultDescription); this.ReportFailure(resultDescription); } else { m_loggerInside.Log(m_currentStatementLine.ToString(), resultDescription); this.SetPassVerdict(); // To indicate that the procedure actually has a verdict set now. } if (m_currentReports != null) { this.AddToReports(new ExpectResultData(this.GetLocationDescription(), title, expected, actual, verdict)); } }
public IList <IPlayer> Voters(Verdict verdict) { return(Verdicts .Where(vote => vote.Value == verdict) .Select(vote => vote.Key) .ToList()); }
public ExecutionResult(Verdict verdict, TimeSpan executionTime, ExecutionFailure failure = null) { m_verdict = verdict; m_returnValue = null; m_executionTime = executionTime; m_failure = failure; }
private static bool CheckAnswer(string pathToAnswer, string outputFile, out Verdict verdict) { string pathToOutput = Path.Combine(Directory.GetCurrentDirectory(), outputFile); string outputText = File.ReadAllText(pathToOutput); string answerText = File.ReadAllText(pathToAnswer); var outputSplitted = outputText.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var answerSplitted = answerText.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (outputSplitted.Length != answerSplitted.Length) { verdict = Verdict.PE; return(false); } for (int i = 0; i < outputSplitted.Length; i++) { answerSplitted[i] = RemoveEmptyLines(answerSplitted[i]); outputSplitted[i] = RemoveEmptyLines(outputSplitted[i]); if (outputSplitted[i] == answerSplitted[i]) { continue; } else { verdict = Verdict.WA; return(false); } } verdict = Verdict.OK; return(true); }
public ProcedureResult(Verdict verdict, int stepIndex, string description, ErrorID error = null) { m_verdict = verdict; m_stepIndex = stepIndex; m_description = description; m_errorID = error; }
public ExecutionResult(object value, TimeSpan executionTime) { m_returnValue = value; m_verdict = Verdict.Unset; m_executionTime = executionTime; m_failure = null; }
public void TestStepBreakOnError(Verdict verdictOutput, object _condition) { // _condition arg cannot be a BreakCondition as BreakCondition is not public. BreakCondition condition = (BreakCondition)_condition; var l = new PlanRunCollectorListener(); TestPlan plan = new TestPlan(); var verdict = new VerdictStep { VerdictOutput = verdictOutput }; BreakConditionProperty.SetBreakCondition(verdict, condition); var verdict2 = new VerdictStep { VerdictOutput = Verdict.Pass }; plan.Steps.Add(verdict); plan.Steps.Add(verdict2); var run = plan.Execute(new[] { l }); Assert.AreEqual(verdictOutput, run.Verdict); Assert.AreEqual(1, l.StepRuns.Count); Assert.AreEqual(BreakCondition.Inherit, BreakConditionProperty.GetBreakCondition(verdict2)); var log = l.LogString; Assert.IsTrue(log.Contains("Break issued from")); }
public void EngineInheritedConditions(Verdict verdictOutput, EngineSettings.AbortTestPlanType abortTestPlanType, int runCount) { Verdict finalVerdict = verdictOutput; var prev = EngineSettings.Current.AbortTestPlan; try { EngineSettings.Current.AbortTestPlan = abortTestPlanType; var l = new PlanRunCollectorListener(); TestPlan plan = new TestPlan(); var verdict = new VerdictStep { VerdictOutput = verdictOutput }; BreakConditionProperty.SetBreakCondition(verdict, BreakCondition.Inherit); var verdict2 = new VerdictStep { VerdictOutput = Verdict.Pass }; plan.Steps.Add(verdict); plan.Steps.Add(verdict2); var run = plan.Execute(new[] { l }); Assert.AreEqual(finalVerdict, run.Verdict); Assert.AreEqual(runCount, l.StepRuns.Count); Assert.AreEqual(BreakCondition.Inherit, BreakConditionProperty.GetBreakCondition(verdict2)); } finally { EngineSettings.Current.AbortTestPlan = prev; } }
public void RepeatWhileError(Verdict targetVerdict, RepeatStep.RepeatStepAction action) { var step = new PassThirdTime(); BreakConditionProperty.SetBreakCondition(step, BreakCondition.BreakOnFail); var rpt = new RepeatStep() { Action = action, TargetVerdict = targetVerdict, Retry = true }; rpt.TargetStep = rpt; // target self. The Repeat Loop will inherit the verdict. rpt.ChildTestSteps.Add(step); var plan = new TestPlan(); plan.ChildTestSteps.Add(rpt); var run = plan.Execute(); Assert.AreEqual(Verdict.Pass, run.Verdict); Assert.AreEqual(3, step.Iterations); }
public Review(int id, Participant reviewer, Verdict verdict, string comments) { Id = id; Reviewer = reviewer; Verdict = verdict; Comments = comments; }
/// <summary> /// Constructs a test case result /// </summary> /// <param name="testNr">test case number</param> /// <param name="verdict">verdict of the test case</param> /// <param name="trace">actions of the test case</param> /// <param name="reason">failure reason</param> /// <param name="executedRequirements">executed requirements</param> public TestResult(int testNr, Verdict verdict, string reason, Sequence <Action> trace, Bag <Pair <string, string> > executedRequirements) // Requirements metrics: ", Sequence<string> executedRequirements" { this.testNr = testNr; this.verdict = verdict; this.trace = trace; this.reason = reason; this.executedRequirements = executedRequirements; }
public Attempt(User user, Problem problem) { User = user; ShippingTime = DateTime.Now; Problem = problem; TestCases = new List <TestCase>(); Verdict = Verdict.Testing; }
public RunningResults(string id, Verdict verdict, string compilationOutput = "", string output = "", string error = "") { Id = id; Verdict = verdict; CompilationOutput = compilationOutput ?? ""; Output = output ?? ""; Error = error ?? ""; }
public ExpectResultData(string location, string id, string expected, string actual, Verdict verdict) : base(DateTime.Now, ReportDataType.ExpectResult) { m_location = location; m_id = id; m_expected = expected; m_actual = actual; m_verdict = verdict; }
/// <summary> /// Initializes a new instance of the TraceBar class. /// </summary> public TraceBar() { BarLength = 30; LowerLimit = -100; UpperLimit = 100; ShowResult = true; ShowVerdict = true; CombinedVerdict = OpenTap.Verdict.NotSet; }
public Run(DateTimeOffset time, TimeSpan span, int runid, int jid, Verdict v, int rank, int timems) { this.time = time; contest_time = span; id = $"{runid}"; judgement_id = $"{jid}"; judgement_type_id = JudgementType.For(v); ordinal = rank; run_time = timems / 1000.0; }
public void ReportFailure(string failureDescription, ErrorID id = null) { m_failCount++; if (m_verdict <= Verdict.Pass) // Only override if no failures reported before. { m_verdict = Verdict.Fail; m_failureDescription = failureDescription; m_failureLine = m_currentStatementLine; m_failureID = id; } }
public static long MethodStaticLongSevaralArgs( long a = 5L, bool b = true, TimeSpan c = default(TimeSpan), string d = "vink", string e = "dab", double f = 2.0, Verdict g = Verdict.Unset) { return(a * 13 + (b ? 3 : 5) + c.Ticks + d.Length + (long)(f * 1000.0)); }
public void UpdateSubmissionStatus(int submission_id, Verdict status) { Submission submission = context.Submissions.Find(submission_id); if (submission == null) { throw new ObjectNotFoundException("Submission with specified id not found"); } submission.Status = context.SubmissionStatus.Find(status); context.SaveChanges(); }
public async Task Should_return_response_if_successful( CastleConfiguration configuration, Verdict response) { Task <Verdict> Send() => Task.FromResult(response); var logger = Substitute.For <IInternalLogger>(); var result = await Authenticate.Execute(Send, configuration, logger); result.Should().Be(response); }
private void AdjustScore(Verdict verdict) { if (verdict == Verdict.Mild) { _scorePenalty -= 3; } else if (verdict == Verdict.Serious) { _scorePenalty -= 6; } _singularPenaltyGiven = true; }
public void ReportError(string errorDescription, ErrorID id = null, Exception ex = null) { m_errorCount++; if (m_verdict <= Verdict.Fail) // Only override if no errors reported before. { m_verdict = Verdict.Error; m_failureDescription = errorDescription; m_failureLine = m_currentStatementLine; m_failureID = id; m_errorException = ex; m_errorListener?.Invoke(m_procedure, m_currentStatementLine, id, errorDescription, ex); } }
private static string Colors(Verdict verdict) { return verdict switch { Verdict.Accepted => "#01df01", Verdict.WrongAnswer => "red", Verdict.TimeLimitExceeded => "orange", Verdict.RuntimeError => "#ff3399", Verdict.MemoryLimitExceeded => "purple", Verdict.CompileError => "grey", Verdict.OutputLimitExceeded => "black", _ => "grey", }; }
public async Task Should_return_request_response_if_no_exception_is_thrown( Verdict response) { var logger = Substitute.For <IInternalLogger>(); async Task <Verdict> DoRequest() { return(await Task.FromResult(response)); } var result = await ExceptionGuard.Try(DoRequest, logger); result.Should().Be(response); }
public virtual void AddFeedback(ref List <string> stringList, string textToAdd, Verdict verdict) { if (!ListContainsString(stringList, textToAdd)) { stringList.Add(textToAdd); } AdjustScore(verdict); if (verdict != Verdict.None && verdict != Verdict.Positive) { UIPopup = FindObjectOfType <UIPopup>(); UIPopup.PopFeedback(verdict, textToAdd); } }
public async Task Should_return_failover_response_if_do_not_track_is_set( CastleConfiguration configuration, Verdict response) { configuration.DoNotTrack = true; configuration.FailOverStrategy = ActionType.Allow; var logger = Substitute.For <IInternalLogger>(); Task <Verdict> Send() => Task.FromResult(response); var result = await Authenticate.Execute(Send, configuration, logger); result.Failover.Should().Be(true); result.FailoverReason.Should().Be("do not track"); }
public override void OnTestPlanRunCompleted(TestPlanRun planRun, System.IO.Stream logStream) { FinalVerdict = planrun.Verdict; if (CrashResultPhase == ResultPhase.PlanRunCompleted) { if (AbortPlan) { TapThread.Current.Abort(); } else { throw new Exception("Intended"); } } planrun = null; }
// Requirements metrics: ", Sequence<string> executedRequirements" /// <summary> /// Constructs a test case result /// </summary> /// <param name="testNr">test case number</param> /// <param name="verdict">verdict of the test case</param> /// <param name="trace">actions of the test case</param> /// <param name="reason">failure reason</param> /// <param name="executedRequirements">executed requirements</param> public TestResult(int testNr, Verdict verdict, string reason, Sequence<Action> trace, Bag<Pair<string, string>> executedRequirements) { this.testNr = testNr; this.verdict = verdict; this.trace = trace; this.reason = reason; this.executedRequirements = executedRequirements; }