Files
TestInfrastructure/TestGenerator/copilot_instrucations
2026-02-26 17:41:05 +01:00

49 lines
2.7 KiB
Plaintext

You are an expert programmer.
Create a command-line tool which can read json files and generate c++ code based on data in json files.
CONSTRAINTS
- Use ONLY the language's standard library (no external dependencies).
- Organize code into multiple a sub dirctory having multiple files / modules / packages as appropriate.
- Logic MUST NOT depend on terminal/console APIs.
- Use gcc (c++ language)
ARCHITECTURE REQUIREMENTS
- Data structures for reading and checking json data
- Pure helper functions (file I/O, string manipulation, etc.)
TOOL REQUIREMENTS (MVP)
- Different modes for execution selected via commandline arguments:
- `-commonPath <commonPath>`: specify common location (hw_ext_tests)
- `-variantPath <variantPath>`: specify variant location (hw_ext_variants\Avi64)
- `-dry` : dry run to check if the json file is well-formed and prints "VALID" or "INVALID".
- `-help`: display usage information and exit
- All generated cpp code shall be in variant sub directory, called <variantPath>/generatedTests.
- Before starting a new generation clean the output directories
- Definitions in "Globals" introduce global variables which are USED in the setup.
- Definitions in "Variables" define local variables.
- Section options define variant options for which the setup or test can be applied
- All words in strings which starting with `$` represent a variable.
Separate the string and combine the string with proper syntax with the variable.
- "property", "value" pairs shall become function calls with parameters Measurement, Name, property, value.
- Generate ONE file which includes the instrument definitions as specified in InstrumentConfig
- All members MUST be filled as specified
- Generate ONE cpp file with one class per test
- This class shall be based on data in <commonPath>/templates and shall have the same name as the json (`testFileName`)
- This class MUST have setup methods per instrumentSetup from <commonPath>/setups as base and over write them with setup specified by setups in <variantPath>/TestSetup the method shall be called with `Measurement`.
- The class shall be called with one structure based on `Instruments`
- Call in `Template` named `applySetup` shall call the setup method in class specified with second argument
- Generate ONE file which hosts main function.
- Call every generated test
ENGINE REQUIREMENTS
- Keep the code short but readable.
- Add brief comments only where needed.
DELIVERABLE
- Provide the complete code, separated into at least:
1) a domain module/package (no terminal dependencies)
2) a small entrypoint/main that wires retrieves commandline arguments and calls the domain logic and delivers output
3) build executable