ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
CLI.integration.hpp File Reference

Shared utilities for CLI integration tests. More...

#include <gtest/gtest.h>
#include "io/TempFile.hpp"
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <string>
#include <sstream>
#include <filesystem>
#include <nlohmann/json.hpp>

Go to the source code of this file.

Classes

struct  ProcessResult
 Captured output of a child-process invocation. More...
 
class  SavedModelTest
 Test fixture that trains a forest model once in SetUp(). More...
 
class  TempDir
 RAII temporary directory with automatic cleanup. More...
 
class  TempFile
 RAII temporary file with automatic cleanup. More...
 

Typedefs

using json = nlohmann::json
 

Functions

ProcessResult run_ppforest2 (std::string const &args)
 Spawn the ppforest2 binary with the given argument string.
 

Variables

const std::string BINARY = PPFOREST2_BINARY_PATH
 
std::string const CRAB_CSV = DATA_DIR + "/crab.csv"
 
std::string const DATA_DIR = PPFOREST2_DATA_DIR
 
std::string const GLASS_CSV = DATA_DIR + "/glass.csv"
 
std::string const GOLDEN_DIR = PPFOREST2_GOLDEN_DIR
 
std::string const IRIS_CSV = DATA_DIR + "/iris.csv"
 
std::string const WINE_CSV = DATA_DIR + "/wine.csv"
 

Detailed Description

Shared utilities for CLI integration tests.

Each test spawns the ppforest2 binary as a child process and checks its exit code and stdout output. Temporary files (TempFile, TempDir) are used for model and output artifacts; they are automatically cleaned up.

Typedef Documentation

◆ json

using json = nlohmann::json

Function Documentation

◆ run_ppforest2()

ProcessResult run_ppforest2 ( std::string const & args)
inline

Spawn the ppforest2 binary with the given argument string.

Stderr is redirected to /dev/null (NUL on Windows) so only stdout is captured. The exit code is extracted via WEXITSTATUS on POSIX.

Parameters
argsSpace-separated argument string appended to the binary path.
Returns
ProcessResult with exit code and captured stdout.

Variable Documentation

◆ BINARY

const std::string BINARY = PPFOREST2_BINARY_PATH
inline

◆ CRAB_CSV

std::string const CRAB_CSV = DATA_DIR + "/crab.csv"
inline

◆ DATA_DIR

std::string const DATA_DIR = PPFOREST2_DATA_DIR
inline

◆ GLASS_CSV

std::string const GLASS_CSV = DATA_DIR + "/glass.csv"
inline

◆ GOLDEN_DIR

std::string const GOLDEN_DIR = PPFOREST2_GOLDEN_DIR
inline

◆ IRIS_CSV

std::string const IRIS_CSV = DATA_DIR + "/iris.csv"
inline

◆ WINE_CSV

std::string const WINE_CSV = DATA_DIR + "/wine.csv"
inline