summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/audio/test_wav_dump.cc3
-rw-r--r--src/tests/audio/test_wav_roundtrip.cc10
-rw-r--r--src/tests/gpu/test_demo_effects.cc6
-rw-r--r--src/tests/gpu/test_effect_base.cc14
-rw-r--r--src/tests/gpu/test_shader_assets.cc7
5 files changed, 19 insertions, 21 deletions
diff --git a/src/tests/audio/test_wav_dump.cc b/src/tests/audio/test_wav_dump.cc
index bfb9d9a..4d9b7ba 100644
--- a/src/tests/audio/test_wav_dump.cc
+++ b/src/tests/audio/test_wav_dump.cc
@@ -58,7 +58,8 @@ void test_wav_format_matches_live_audio() {
for (float t = 0.0f; t < duration; t += update_dt) {
for (int i = 0; i < samples_per_update; i += 2) {
- const float phase = 2.0f * 3.14159265f * freq * (float)sample_index / sample_rate;
+ const float phase =
+ 2.0f * 3.14159265f * freq * (float)sample_index / sample_rate;
const float s = 0.5f * sinf(phase);
chunk_buffer[i] = s; // L
chunk_buffer[i + 1] = s; // R
diff --git a/src/tests/audio/test_wav_roundtrip.cc b/src/tests/audio/test_wav_roundtrip.cc
index 79de6ad..30f6cda 100644
--- a/src/tests/audio/test_wav_roundtrip.cc
+++ b/src/tests/audio/test_wav_roundtrip.cc
@@ -12,8 +12,7 @@ static const int SAMPLE_RATE = 32000;
static const float PI = 3.14159265358979323846f;
static float compute_snr_db(const std::vector<float>& ref,
- const std::vector<float>& out,
- int skip_samples) {
+ const std::vector<float>& out, int skip_samples) {
const int n = (int)std::min(ref.size(), out.size());
double sig = 0.0, noise = 0.0;
for (int i = skip_samples; i < n; ++i) {
@@ -21,7 +20,8 @@ static float compute_snr_db(const std::vector<float>& ref,
double e = ref[i] - out[i];
noise += e * e;
}
- if (noise < 1e-30) return 999.0f;
+ if (noise < 1e-30)
+ return 999.0f;
return 10.0f * (float)log10(sig / noise);
}
@@ -45,8 +45,8 @@ int main() {
// SNR — skip first DCT_SIZE samples (ramp-up transient)
const float snr = compute_snr_db(input, output, DCT_SIZE);
- printf("Roundtrip SNR: %.1f dB (frames=%d, out_samples=%zu)\n",
- snr, num_frames, output.size());
+ printf("Roundtrip SNR: %.1f dB (frames=%d, out_samples=%zu)\n", snr,
+ num_frames, output.size());
const float MIN_SNR_DB = 30.0f;
if (snr < MIN_SNR_DB) {
diff --git a/src/tests/gpu/test_demo_effects.cc b/src/tests/gpu/test_demo_effects.cc
index b005662..5c4bffc 100644
--- a/src/tests/gpu/test_demo_effects.cc
+++ b/src/tests/gpu/test_demo_effects.cc
@@ -58,9 +58,9 @@ static void test_effects() {
{"Hybrid3D", std::make_shared<Hybrid3D>(
fixture.ctx(), std::vector<std::string>{"source"},
std::vector<std::string>{"sink"}, 0.0f, 1000.0f)},
- {"Flash", std::make_shared<Flash>(fixture.ctx(),
- std::vector<std::string>{"source"},
- std::vector<std::string>{"sink"}, 0.0f, 1000.0f)},
+ {"Flash", std::make_shared<Flash>(
+ fixture.ctx(), std::vector<std::string>{"source"},
+ std::vector<std::string>{"sink"}, 0.0f, 1000.0f)},
{"PeakMeter", std::make_shared<PeakMeter>(
fixture.ctx(), std::vector<std::string>{"source"},
std::vector<std::string>{"sink"}, 0.0f, 1000.0f)},
diff --git a/src/tests/gpu/test_effect_base.cc b/src/tests/gpu/test_effect_base.cc
index 64e5fa4..e73f4d7 100644
--- a/src/tests/gpu/test_effect_base.cc
+++ b/src/tests/gpu/test_effect_base.cc
@@ -104,10 +104,9 @@ static void test_effect_in_sequence() {
class TestSequence : public Sequence {
public:
TestSequence(const GpuContext& ctx, int w, int h) : Sequence(ctx, w, h) {
- auto effect =
- std::make_shared<Passthrough>(ctx, std::vector<std::string>{"source"},
- std::vector<std::string>{"sink"}, 0.0f,
- 1000.0f);
+ auto effect = std::make_shared<Passthrough>(
+ ctx, std::vector<std::string>{"source"},
+ std::vector<std::string>{"sink"}, 0.0f, 1000.0f);
effect_dag_.push_back({effect, {"source"}, {"sink"}, 0});
init_effect_nodes();
@@ -137,10 +136,9 @@ static void test_sequence_render() {
class TestSequence : public Sequence {
public:
TestSequence(const GpuContext& ctx, int w, int h) : Sequence(ctx, w, h) {
- auto effect =
- std::make_shared<Passthrough>(ctx, std::vector<std::string>{"source"},
- std::vector<std::string>{"sink"}, 0.0f,
- 1000.0f);
+ auto effect = std::make_shared<Passthrough>(
+ ctx, std::vector<std::string>{"source"},
+ std::vector<std::string>{"sink"}, 0.0f, 1000.0f);
effect_dag_.push_back({effect, {"source"}, {"sink"}, 0});
init_effect_nodes();
diff --git a/src/tests/gpu/test_shader_assets.cc b/src/tests/gpu/test_shader_assets.cc
index 084694d..1ceb49d 100644
--- a/src/tests/gpu/test_shader_assets.cc
+++ b/src/tests/gpu/test_shader_assets.cc
@@ -60,10 +60,9 @@ int main() {
all_passed &=
validate_shader(AssetId::ASSET_SHADER_PARTICLE_RENDER, "PARTICLE_RENDER",
{"@vertex", "vs_main", "@fragment", "fs_main"});
- all_passed &=
- validate_shader(AssetId::ASSET_SHADER_PASSTHROUGH, "PASSTHROUGH",
- {"#include \"render/fullscreen_uv_vs\"", "@fragment",
- "fs_main"});
+ all_passed &= validate_shader(
+ AssetId::ASSET_SHADER_PASSTHROUGH, "PASSTHROUGH",
+ {"#include \"render/fullscreen_uv_vs\"", "@fragment", "fs_main"});
all_passed &= validate_shader(
AssetId::ASSET_SHADER_ELLIPSE, "ELLIPSE",
{"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});