THINK FIRST·CODE LATER

← All labs

Is it really done? Checking an agent's claim against the spec

Problem

An agent reports: "Issue #214 is done." Verify the claim with the specification and the test results.

Input:

SPEC
<lines: criterionId description...>
TESTS
<lines: testName PASS|FAIL criterionId1,criterionId2,...  (or - for none)>

A criterion is:

  • MET if it has at least one test and all its tests pass;
  • FAILING if at least one of its tests fails;
  • UNVERIFIED if no test covers it.

Output one line per criterion in spec order: AC1: MET (2 tests), AC2: FAILING (1 of 3 tests failed), AC3: UNVERIFIED. Then, if any, Tests not linked to the spec: t1, t2 (tests with - or only unknown criterion ids, in input order). Finally:

  • Verdict: DONE if every criterion is MET;
  • otherwise Verdict: NOT DONE (f failing, u unverified).

Input:

SPEC
AC1 Sunday slots are included in matching
AC2 Slots that only touch do not match
AC3 Students with no free time get an empty list
TESTS
sundayMatched PASS AC1
sundayOverlap30 PASS AC1
touchingSlots FAIL AC2
formatsTime PASS -

Output:

AC1: MET (2 tests)
AC2: FAILING (1 of 1 tests failed)
AC3: UNVERIFIED
Tests not linked to the spec: formatsTime
Verdict: NOT DONE (1 failing, 1 unverified)

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.