lac-dcc / lac-dcc/BenchGen

Add validation to ensure `iterations` is greater than zero and create ùsage()`

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

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

File CodeGeneratorDriver.cpp

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.