Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
validation_assertions.hpp File Reference

Framework-agnostic correctness checks for plugin/example validation tests. More...

#include <pulp/audio/buffer.hpp>
#include <pulp/format/headless.hpp>
#include <pulp/midi/buffer.hpp>
#include <pulp/midi/ump_buffer.hpp>
#include <pulp/state/parameter.hpp>
#include <pulp/state/store.hpp>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <span>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::format::validation::CheckResult
 Outcome of a single validation check. More...

Namespaces

namespace  pulp
namespace  pulp::format
 What the product grants a device: the quota table indexed by capability tier and live thermal state.
namespace  pulp::format::validation

Functions

CheckResult pulp::format::validation::check_finite (std::span< const float > samples)
 True when no sample is NaN or infinite.
template<typename Sample>
CheckResult pulp::format::validation::check_finite (const audio::BufferView< Sample > &buffer)
 True when no sample is NaN or infinite.
CheckResult pulp::format::validation::check_any_nonzero (std::span< const float > samples, float eps=1.0e-7f)
 True when at least one sample's magnitude exceeds eps — i.e.
CheckResult pulp::format::validation::check_silent (std::span< const float > samples, float eps=1.0e-7f)
 True when every sample's magnitude is at or below eps — the inverse of check_any_nonzero, for "bypass with zero input must be silent" style tests.
CheckResult pulp::format::validation::check_peak_below (std::span< const float > samples, float peak_limit)
 True when every sample's magnitude is at or below peak_limit (linear, not dB).
CheckResult pulp::format::validation::check_param_round_trip (const state::ParamRange &range, float raw, float tol=1.0e-4f)
 Verify a parameter's normalize↔denormalize map is correct for raw.
CheckResult pulp::format::validation::check_state_round_trip (HeadlessHost &host)
 Verify plugin state actually round-trips: save a snapshot, perturb every parameter to a different value, restore the snapshot, and require the re-saved bytes to match the original.
CheckResult pulp::format::validation::check_sysex_payload_equal (std::span< const uint8_t > expected, std::span< const uint8_t > actual)
 True when two SysEx payloads carry identical bytes.
CheckResult pulp::format::validation::check_midi_events_equal (const midi::MidiBuffer &expected, const midi::MidiBuffer &actual)
 True when two MIDI buffers carry the same short messages (bytes + sample offset, in order), the same SysEx payloads (bytes + sample offset), and the same UMP (MIDI 2.0) sidecar packets.

Detailed Description

Framework-agnostic correctness checks for plugin/example validation tests.

These helpers cover the recurring "did the DSP/state/MIDI actually behave" questions that every example test re-implements by hand: output finiteness, silence/non-silence, peak bounds, parameter normalize↔denormalize stability, state save/load determinism, and MIDI/SysEx equality.

Each helper returns a CheckResult (a bool plus a human-readable message) so it composes with any test framework — Catch2, GoogleTest, or a bare if (!result) { ... }. The header intentionally does NOT depend on a test framework, so it ships with the SDK and is reusable by downstream example projects that consume the installed Pulp headers:

auto out = harness.process_buffer(input, 2, 512);
CheckResult check_any_nonzero(std::span< const float > samples, float eps=1.0e-7f)
True when at least one sample's magnitude exceeds eps — i.e.
Definition validation_assertions.hpp:98
CheckResult check_finite(std::span< const float > samples)
True when no sample is NaN or infinite.
Definition validation_assertions.hpp:65
CheckResult check_state_round_trip(HeadlessHost &host)
Verify plugin state actually round-trips: save a snapshot, perturb every parameter to a different val...
Definition validation_assertions.hpp:257

Screenshot content-floor checks are intentionally NOT duplicated here — use pulp::view::ScreenshotContentStats::passes_content_floor() (which already exists in core/view) so the format layer keeps no dependency on the view layer.