~kdsch/sampler

eb4b5ac59678485c3def51766cffb2a51dc69234 — Karl Schultheisz 1 year, 4 months ago 64d3a27
posix/test: make struct literal spacing uniform
1 files changed, 29 insertions(+), 29 deletions(-)

M posix/test/main.c
M posix/test/main.c => posix/test/main.c +29 -29
@@ 50,9 50,9 @@ test_frac_part_nn(struct test *t)
		float input;
		float want;
	} c, cases[] = {
		{ "zero", 0, 0 },
		{ "half", 0.5f, 0.5f },
		{ "one", 1, 0 },
		{"zero", 0, 0},
		{"half", 0.5f, 0.5f},
		{"one", 1, 0},
	};

	for (size_t i = 0; i < len(cases); i++) {


@@ 84,12 84,12 @@ test_interp(struct test *t)
		float index;
		float want;
	} c, cases[] = {
		{ "linear zero", interp_linear, &step, 0, 0 },
		{ "linear one", interp_linear, &step, 1, 1 },
		{ "linear half", interp_linear, &step, 0.5f, 0.5f },
		{ "hold zero", interp_hold, &step, 0, 0 },
		{ "hold one", interp_hold, &step, 1, 1 },
		{ "hold half", interp_hold, &step, 0.5f, 0 },
		{"linear zero", interp_linear, &step, 0, 0},
		{"linear one", interp_linear, &step, 1, 1},
		{"linear half", interp_linear, &step, 0.5f, 0.5f},
		{"hold zero", interp_hold, &step, 0, 0},
		{"hold one", interp_hold, &step, 1, 1},
		{"hold half", interp_hold, &step, 0.5f, 0},
	};

	for (size_t i = 0; i < len(cases); i++) {


@@ 205,9 205,9 @@ test_convert_int16_to_float(struct test *t)
		int16_t input;
		float want;
	} c, cases[] = {
		{ "min", -INT16_MAX, -1 },
		{ "zero", 0, 0 },
		{ "max", INT16_MAX, 1 },
		{"min", -INT16_MAX, -1},
		{"zero", 0, 0},
		{"max", INT16_MAX, 1},
	};




@@ 230,10 230,10 @@ test_convert_float_to_int16(struct test *t)
		float input;
		int16_t want;
	} c, cases[] = {
		{ "min", -1, -INT16_MAX},
		{ "zero", 0, 0 },
		{ "half", 0.5f, INT16_MAX/2 },
		{ "max", 1, INT16_MAX },
		{"min", -1, -INT16_MAX},
		{"zero", 0, 0},
		{"half", 0.5f, INT16_MAX/2},
		{"max", 1, INT16_MAX},
	};




@@ 281,12 281,12 @@ test_frames_per_step(struct test *t)
		uint16_t bpm_x10;
		float want;
	} c, cases[] = {
		{ "44.1kHz, 80bpm", 44.1e3, 800, 8268.75f },
		{ "44.1kHz, 120bpm", 44.1e3, 1200, 5512.5f },
		{ "44.1kHz, 180bpm", 44.1e3, 1800, 3675 },
		{ "48kHz, 80bpm", 48e3, 800, 9e3 },
		{ "48kHz, 120bpm", 48e3, 1200, 6e3 },
		{ "48kHz, 180bpm", 48e3, 1800, 4e3 },
		{"44.1kHz, 80bpm", 44.1e3, 800, 8268.75f},
		{"44.1kHz, 120bpm", 44.1e3, 1200, 5512.5f},
		{"44.1kHz, 180bpm", 44.1e3, 1800, 3675},
		{"48kHz, 80bpm", 48e3, 800, 9e3},
		{"48kHz, 120bpm", 48e3, 1200, 6e3},
		{"48kHz, 180bpm", 48e3, 1800, 4e3},
	};

	for (size_t i = 0; i < len(cases); i++) {


@@ 316,13 316,13 @@ test_close_enough(struct test *t)
		float tolerance;
		bool want;
	} c, cases[] = {
		{ "1 = 1", 1, 1, 0, true },
		{ "1 ≠ 1 + ε", 1, 1 + FLT_EPSILON, 0, false },
		{ "1 ≅ 1 + ε", 1, 1 + FLT_EPSILON, FLT_EPSILON, true },
		{ "1 ≠ 1 + ε", 1, 1 + FLT_EPSILON, FLT_EPSILON/2, false },
		{ "1 ≠ 1 + 2ε", 1, 1 + 2*FLT_EPSILON, FLT_EPSILON, false },
		{ "1 ≠ 0", 1, 0, FLT_EPSILON, false },
		{ "1 ≠ ε", 1, FLT_EPSILON, FLT_EPSILON, false },
		{"1 = 1", 1, 1, 0, true},
		{"1 ≠ 1 + ε", 1, 1 + FLT_EPSILON, 0, false},
		{"1 ≅ 1 + ε", 1, 1 + FLT_EPSILON, FLT_EPSILON, true},
		{"1 ≠ 1 + ε", 1, 1 + FLT_EPSILON, FLT_EPSILON/2, false},
		{"1 ≠ 1 + 2ε", 1, 1 + 2*FLT_EPSILON, FLT_EPSILON, false},
		{"1 ≠ 0", 1, 0, FLT_EPSILON, false},
		{"1 ≠ ε", 1, FLT_EPSILON, FLT_EPSILON, false},
	};

	for (size_t i = 0; i < len(cases); i++) {