Add validation to ensure `iterations` is greater than zero and create ùsage()`
Open
Nobody has claimed this yet.
enhancement
good first issue
- Dominant language
- TeX
- Stars
- 47
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Insert a check to ensure the iterations variable is greater than zero.
try{
iterations = std::stoi(argv[1]);
}catch(const std::invalid_argument& e)
{
std::cout << “Number of iterations should be integer!” << std::endl;
return 1;
}
Create a usage() function for this code snippet.
if (argc < 6) {
std::cout << “ERROR! Missing arguments!” << std::endl;
std::cout << “Please provide Number of Iterations, Production Rules, Seed String File, Output Folder Name and Variable Type.” << std::endl;
std::cout << “Usage: ./benchGen <number_of_iterations> <production_rules_file> <seed_string_file> <bench_name> <var_type>” << std::endl;
return 1;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/gen/CodeGeneratorDriver.cpp and read its current command-line argument parsing. Check the behavior for missing arguments, non-integer iterations, and zero or negative iterations. Done means invalid inputs produce clear errors and the usage message is available through the requested usage() function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100