Skip to main content

Practice ยท 3 of 3

Capstone seam 3: the validation boundary

Complete Catalog::validate(const NewBook&) const returning std::optional<AddError>: EmptyTitle for an empty title, BadQuantity for quantity <= 0, Duplicate when the title already exists in the catalog, and std::nullopt when the book may be added. Check in that order โ€” a test feeds an empty title with quantity 0 and expects EmptyTitle.

Difficulty: intermediate

Back to lesson: Practice: Capstone seams