Advanced level · Module 6: C++ Capstone Project · Lesson 2 of 5
Core Library Implementation
Implement parsing, validation and statistics as a tested library.
In this lesson you will
- Implement the core library using modern C++ idioms
- Test it thoroughly, including malformed input
Key concepts
streaming parservalidation rulesstatisticstest coverage
The lesson
Process the input as a stream rather than loading everything into memory, so large files work on small machines. Parse each line into a record or an error result.
Validation rules — impossible values, missing fields, timestamps out of order — produce error results with line numbers rather than exceptions, according to your error-handling policy.
Test each function with normal, boundary and invalid inputs. Run the tests under AddressSanitizer and UndefinedBehaviorSanitizer.
Step by step
- Implement the line parser and validation.
- Implement the daily statistics.
- Write tests for each.
- Run the tests under sanitizers.
Practice activity
Complete milestone 2: the tested core library.
Expected result: All library tests pass under sanitizers.
Check your understanding
-
Why stream the input instead of loading it all?
Show answer
To handle large files on computers with little memory.
-
How should malformed lines be handled according to the design?
Show answer
As error results with line numbers, following the project's error-handling policy.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.