JamieLine / UnmaskedCXX

Automatic test generation for C/C++ Programs (WIP)
Other
0 stars 0 forks source link

Restructure the parser to be Amenable to the Generator Linking issue and the Segmenting issue #27

Closed JamieLine closed 6 months ago

JamieLine commented 8 months ago

Links to #26, #6 (mainly the predicate test), #21

Broadly

JamieLine commented 8 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;
}
JamieLine commented 8 months ago

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)