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)

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

s14-3-data-1.txt

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 -
What your program must print for s14-3-data-1.txt
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)

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < s14-3-data-1.txt

Windows PowerShell does not understand <:

Get-Content s14-3-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

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.