Closed JamieLine closed 6 months ago
Mockup of Predicate Test Template
ADDITIONAL_INCLUDES
#include ...
#include ...
bool FUNCTION_NAME():
SETUP_INFRASTRUCTURE
for (NumTests in [0, NumTestsToRun)) {
SETUP_GENERATORS
STORE_FUNCTION_VALUE
}
bool Passed = CREATE_PREDICATE_CALL;
OUTPUT_INFORMATION
return Passed;
}
The new layout will probably want to look something like this
Directory Structure
TestCreator/
MicroParsers/ (Read specifications in)
ParseIndexValuePair.h/.cpp (Likely no validation here, the Big Parser has more chance to handle any issues)
ParseFunctionNameAndTypes.h/.cpp
ParsePredicate.h/.cpp
...
...
...
Structs/ (Intermediate representation)
IndexValuePair.h
Predicate.h
...
...
...
SegmentWriters/ (return replacement for an individual segment)
WriteSetupInfrastructure.h/.cpp
WriteAdditionalIncludes.h/.cpp
...
...
TemplateWriters/ (actually writes a full test to a file)
WritePredicateTest.h/.cpp
WriteTestRunner.h/.cpp
...
...
Parser.h/.cpp (takes in someone else's file and makes all the tests as a vector of `GeneratedTest` objects which have their own write to file method to call later)
Main.cpp (instructs the parser to go over every needed file, then directly calls `WriteTestRunner` which uses that vector, then tells `FilesystemHandler` to write it all to disk)
FilesystemHandler.h/.cpp (utilities to read from and write to the filesystem, including writing the vector of tests to appropriate roles and eventually scanning a directory recursively)
Links to #26, #6 (mainly the predicate test), #21
Broadly
Create{Type}Test
functions can then be decomposed into parts which populate Segments from some small object, created from the original spec. This will probably include having some MicroParsers which can do things such as "read an Index-Value Pair" or "Get the name and types associated with a function".UnmaskedStabilisingSetTest
andUnmaskedAlwaysReturnValueTest
with predicate test redefinitions.