1.4 KiB
1.4 KiB
Backend internal interview (rust)
CHANGES: fixed branch
- Moving from HashMap to BTreeMap to preseve loading lines order.
- Fix lines parser in Maps metrics and in aggregated_metrics to be handled properly.
- Fix unwrap / expect for obvious reasons, add simple error message via map_err, unwrap_or_else and closure function.
- Fix some source code lines order, output format and conversions.
- Change some iterators to functional mode.
- Separate tasks to independent funtions for better isolation, less responsibilities and help on tests handling.
- Adding output_path to help on result output options.
- Following unit tests are implemented:
- test_load_input test load input file input.txt.
- test_invalid_line_value test use invalid value in line parsing.
- test_invalid_line test use invlid value in line parsing.
- test_expected_metrics test load input data from input.txt compare with output_expected.txt.
Note
Code simply works as expected
It is not be able to process multiple metrics in parallel yet.
A full refactoring has to be done for better quality, maintenance and be more readable. (Structs, implementaitions, settings for multiple inputs, etc).
Next round in: Improve branch