Propagation and unwinding

F-ERRPROP-V4-2medium

Name the hedge, keep the cause

A garden planner prices hedges from a price list: box costs 4 and yew 6 per metre.

What needs to change

Repair hedgeCost so the failure names the hedge and keeps the original cause.

Reproduce

  1. Use `clang++ -std=c++2c -Wall -Wextra -pedantic main.cpp -o main && ./main` with the sample stdin and compare the failure context and its unknown-plant tag.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its headers, readRows, UnknownPlant, perMetre, describe, hedgeCost and main. describe follows nested exceptions.

Input: a hedge name, a plant and a length in metres on each line.

Input contains at most 50 hedge records, one per LF/CRLF line. Ordinary ASCII spaces/tabs separate the three fields; ASCII spaces/tabs/CR frame a line. Blank framed lines are ignored.

Names and plant codes are opaque valid UTF-8 tokens of at most 64 bytes, excluding ASCII space, tab, CR and LF. Names and plant codes also exclude U+0000. Other characters, including BOM and NEL, stay part of the token. A physical line has at most 4096 bytes.

A length is an optional plus or minus followed by ASCII decimal digits, with numeric value from -100 through 100. Leading zeros are allowed. The supplied reader receives valid fields; these are input assumptions, not a validation task.

The line calculation accepts signed lengths, including zero. A known price is multiplied by that value; unknown plants remain failures.

Products are integers from -600 through 600, within the native numeric representations used here.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in