This repository reflects Makers coding review 1, conducted 23/02/2022.
- Installation
- Specification
- Acceptance Criteria
- Final Appearance
- Dependencies
- Author(s)
- License(s)
- Acknowledgements
This project requires Ruby 3.0.0. If you do not have Ruby 3.0.0, install it using these instructions.
- Clone or fork this repository.
- Install the necessary Gems from the
Gemfile
by executingbundle install
.
- The purpose of this program is process school test results.
- This program receives input of results as a string of comma-separated values. These values could be in any combination of upper- and lower-case.
- This program should parse this string, and sum the total of each instance of the colours
green
,amber
andred
. - The program should return the totals in the format
Colour: #
, with each of the three colours returned on a new line. - Even if no instances of the three colours are found, the sum of that colour should be returned.
- This program should sum the total of any instance of any other input as
Uncounted
. - If no
Uncounted
instances are found, the program should not returnUncounted
as a category.
Input | Output |
---|---|
"Green" | Green: 1 |
"Green, green" | Green: 2 |
"Green, AMBER, Red" | Green: 1\nAmber: 1\nRed: 1\n |
"Green, Yellow" | Green: 1\nUncounted: 1 |
This program must:
- Parse the input of a string of the colour green, amber or red.
- Parse the input of a CSV string of at least two instances of the colour green, amber or red.
- Parse the input of a CSV string of at least two of the colours green, amber and red.
- Parse the input of a CSV string of colours which are not green, amber or red.
- Raise error
Please input a string of comma-separated values.
upon the input of anything other than aString
object.
Input | Output |
---|---|
"Green" | Green: 1\nAmber: 0\nRed: 0 |
"Green, green" | Green: 2\nAmber: 0\nRed: 0 |
"Green, Amber, red" | Green: 1\nAmber: 1\nRed: 1\n |
"Green, Yellow" | Green: 1\n\nAmber: 0\nRed: 0\nUncounted: 1 |
"Green, Amber, RED, green, Yellow, Red" | Green: 2\nAmber: 1\nRed: 2\nUncounted: 1 |
["Green", "Amber", "Red"] | Error Please input a string of comma-separated values. |
This program is pictured below executing the instructions in the Acceptance Criteria.
This program's dependencies are minimal and relate solely to testing. All dependencies are explicitly invoked in the Gemfile
.
- Ruby, courtesy of Yukihiro Matsumoto.
- RSpec, courtesy of Jon Rowe, Benoit Tigeot, Phil Pirozhkov, Xavier Shay and Yuji Nakayama.
- Rubocop and Rubocop-RSpec, both courtesy of Bozhidar Batsov.
- SimpleCov, courtesy of Christoph Olszowka.
- SimpleCov-Console, courtesy of Chetan Sarva.
Authored by Joshua Sinyor.
This project is licensed under the MIT License.
- Table of contents generated with markdown-toc.
- Markdown tables generated with TablesGenerator.