|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
C unit tests for I/O helpers, parsers, and startup-banner output. More...
#include "test_support.h"#include "checksum.h"#include "io.h"#include "statistics_accumulator.h"#include "statistics_window.h"#include "field_catalog.h"#include <fcntl.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>Go to the source code of this file.
Functions | |
| static PetscErrorCode | TestShouldWriteDataOutput (void) |
| Tests cadence-based Eulerian output triggering. | |
| static PetscErrorCode | TestVerifyPathExistence (void) |
| Tests filesystem existence checks for files and directories. | |
| static PetscErrorCode | TestWriteAndReadSimulationFields (void) |
| Tests writing and reloading core Eulerian field vectors. | |
| static PicurvWindowDefinition | StatisticsFixtureDefinition (void) |
| Builds the statistics fixture: one Ucat/P window with a second moment. | |
| static PetscErrorCode | AttachStatisticsFixture (SimCtx *simCtx, UserCtx *user, PicurvWindow *window, PicurvWindowStorage *storage, const PicurvWindowDefinition *definition) |
| Attaches one accumulating window to a fixture context and primes it with samples. | |
| static PetscErrorCode | DetachStatisticsFixture (SimCtx *simCtx, UserCtx *user, PicurvWindowStorage *storage) |
| Detaches the statistics fixture without disturbing the shared teardown. | |
| static PetscErrorCode | WriteCompletedStatisticsWindow (SimCtx *simCtx, UserCtx *user, PicurvWindow *window, PicurvWindowStorage *storage, const PicurvWindowDefinition *definition) |
| Rewrites the bundle holding a window that closed well before the checkpoint time. | |
| static PetscErrorCode | TestCheckpointStatisticsRoundTrip (void) |
| Verifies accumulated statistics survive a checkpoint round trip unchanged. | |
| static PetscErrorCode | TestCheckpointStatisticsContinuationGuards (void) |
| Verifies continuation refuses every state that would corrupt an average. | |
| static PetscErrorCode | TestCheckpointStatisticsPayloadIsValidated (void) |
| A damaged statistics payload must fail bundle validation, not load silently. | |
| static PetscErrorCode | TestCheckpointStatisticsAbsentWhenDisabled (void) |
| A run without statistics writes no statistics subtree and refuses to fake one. | |
| static PetscErrorCode | TestCheckpointSameStepRewriteIsRejected (void) |
| Verifies a committed checkpoint step is rewritten neither silently nor inconsistently. | |
| static PetscErrorCode | TestCheckpointSHA256KnownVector (void) |
| Verifies the dependency-free SHA-256 implementation against a standard vector. | |
| static PetscErrorCode | TestParsePostProcessingSettings (void) |
| Tests parsing of post-processing control settings from a file. | |
| static PetscErrorCode | TestTrimWhitespace (void) |
| Tests trimming of leading and trailing whitespace. | |
| static PetscErrorCode | TestBoundaryConditionStringParsers (void) |
| Tests boundary-condition string parsers for face, type, and handler names. | |
| static PetscErrorCode | TestValidateBCHandlerForBCType (void) |
| Tests validation of boundary-type and handler compatibility. | |
| static PetscErrorCode | TestParseScalingInformation (void) |
| Tests scaling-reference parsing and derived pressure scaling. | |
| static PetscErrorCode | CaptureBannerOutput (SimCtx *simCtx, char *captured, size_t captured_len) |
| Captures the startup banner into a temporary file-backed buffer. | |
| static PetscErrorCode | AssertCapturedContains (const char *captured, const char *needle, const char *message) |
| Asserts that captured banner output contains one expected substring. | |
| static PetscErrorCode | AssertCapturedOmits (const char *captured, const char *needle, const char *message) |
| Asserts that captured banner output omits one forbidden substring. | |
| static PetscErrorCode | TestDisplayBannerReportsStatisticsCadence (void) |
| Tests that the startup banner reports statistics monitoring in every state. | |
| static PetscErrorCode | TestDisplayBannerTracksConditionalStartupFields (void) |
| Tests conditional startup-banner fields across particle and analytical cases. | |
| int | main (int argc, char **argv) |
| Runs the unit-io PETSc test binary. | |
C unit tests for I/O helpers, parsers, and startup-banner output.
Definition in file test_io.c.
|
static |
Tests cadence-based Eulerian output triggering.
Definition at line 23 of file test_io.c.
|
static |
Tests filesystem existence checks for files and directories.
Definition at line 40 of file test_io.c.
|
static |
Tests writing and reloading core Eulerian field vectors.
Definition at line 68 of file test_io.c.
|
static |
Builds the statistics fixture: one Ucat/P window with a second moment.
Definition at line 128 of file test_io.c.
|
static |
Attaches one accumulating window to a fixture context and primes it with samples.
Definition at line 144 of file test_io.c.
|
static |
Detaches the statistics fixture without disturbing the shared teardown.
Definition at line 159 of file test_io.c.
|
static |
Rewrites the bundle holding a window that closed well before the checkpoint time.
Reproduces the shape a real run reaches when a bounded window finished and the simulation kept going: the saved state is complete, and its end sits behind the checkpoint by far more than one step.
Definition at line 178 of file test_io.c.
|
static |
Verifies accumulated statistics survive a checkpoint round trip unchanged.
Both halves of the state matter and are checked separately: the per-point accumulator vectors, and the window's scalar bookkeeping. Restoring only the vectors would silently resume with a broken schedule, and restoring only the scalars would report a sample count the fields do not support.
Definition at line 216 of file test_io.c.
|
static |
Verifies continuation refuses every state that would corrupt an average.
A silent reset is the failure mode this guards: resuming from zero, or merging samples taken under a different definition, both produce a window whose reported sample count no longer describes the numbers it carries.
Definition at line 348 of file test_io.c.
|
static |
A damaged statistics payload must fail bundle validation, not load silently.
Statistics payloads are validated because they enter the manifest inventory the existing validator already walks. That is an easy property to believe and an easy one to lose, so it is checked by damaging a payload rather than by inspection.
Definition at line 457 of file test_io.c.
|
static |
A run without statistics writes no statistics subtree and refuses to fake one.
Definition at line 519 of file test_io.c.
|
static |
Verifies a committed checkpoint step is rewritten neither silently nor inconsistently.
WriteCheckpointBundle revalidates an already-committed step instead of rewriting it, so a repeated call at the same step must leave the payloads byte-identical even when the in-memory state has since diverged. The same guard must reject a repeat call whose physical time disagrees with the committed bundle, because that means the step number no longer identifies the same solver state.
Definition at line 572 of file test_io.c.
|
static |
Verifies the dependency-free SHA-256 implementation against a standard vector.
Definition at line 638 of file test_io.c.
|
static |
Tests parsing of post-processing control settings from a file.
Definition at line 657 of file test_io.c.
|
static |
Tests trimming of leading and trailing whitespace.
Definition at line 698 of file test_io.c.
|
static |
Tests boundary-condition string parsers for face, type, and handler names.
Definition at line 717 of file test_io.c.
|
static |
Tests validation of boundary-type and handler compatibility.
Definition at line 742 of file test_io.c.
|
static |
Tests scaling-reference parsing and derived pressure scaling.
Definition at line 759 of file test_io.c.
|
static |
Captures the startup banner into a temporary file-backed buffer.
Definition at line 794 of file test_io.c.
|
static |
Asserts that captured banner output contains one expected substring.
Definition at line 840 of file test_io.c.
|
static |
Asserts that captured banner output omits one forbidden substring.
Definition at line 849 of file test_io.c.
|
static |
Tests that the startup banner reports statistics monitoring in every state.
The banner is the one place a log records whether monitoring was active, so all three states must be distinguishable after the fact: a live cadence, a subsystem that is accumulating with the console silenced, and a run that configured no window at all. The banner reads only the window array and the console cadence, so this fixture sets those directly rather than allocating accumulator storage it would never touch.
Definition at line 865 of file test_io.c.
|
static |
Tests conditional startup-banner fields across particle and analytical cases.
Definition at line 910 of file test_io.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Runs the unit-io PETSc test binary.
Definition at line 1047 of file test_io.c.