Add test for 16-bit output, also moving the testname for test_renderer into compiler definition to avoid rewriting it everytime.

This commit is contained in:
Veikko Sariola 2020-04-15 23:17:03 +03:00
parent cff4538b8c
commit 83e3ab165e
23 changed files with 28 additions and 71 deletions

View File

@ -1,15 +1,22 @@
function(regression_test name)
add_executable(${name} ${name}.asm test_renderer.c)
add_test(${name} ${name})
function(regression_test testname)
if(${ARGC} LESS 2)
set(source ${testname})
else()
set(source ${ARGV1})
endif()
add_executable(${testname} ${source}.asm test_renderer.c)
add_test(${testname} ${testname})
target_compile_definitions(${testname} PUBLIC TEST_NAME="${testname}")
set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/${name}_expected.raw)
set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/${name}_expected.raw)
set (rawinput ${CMAKE_CURRENT_SOURCE_DIR}/${testname}_expected.raw)
set (rawoutput ${CMAKE_CURRENT_BINARY_DIR}/${testname}_expected.raw)
add_custom_target(${name}_rawcopy
add_custom_target(${testname}_rawcopy
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${rawinput} ${rawoutput}
)
add_dependencies(${name} ${name}_rawcopy)
add_dependencies(${testname} ${testname}_rawcopy)
endfunction(regression_test)
regression_test(test_envelope)
@ -32,6 +39,9 @@ regression_test(test_vco_noise)
regression_test(test_vco_pulse)
regression_test(test_vco_gate)
regression_test(test_vco_stereo)
regression_test(test_envelope_16bit test_envelope)
target_compile_definitions(test_envelope_16bit PUBLIC GO4K_USE_16BIT_OUTPUT)
set_tests_properties(test_envelope PROPERTIES FIXTURES_SETUP ENVELOPE)
set_tests_properties(test_panning PROPERTIES FIXTURES_REQUIRED ENVELOPE)

View File

@ -642,9 +642,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_envelope', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

Binary file not shown.

View File

@ -644,9 +644,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_add', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -650,9 +650,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_addp', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_addp2', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -642,9 +642,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_loadnote', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -644,9 +644,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_mul', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -650,9 +650,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_mulp', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_mulp2', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -646,9 +646,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_pop', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -646,9 +646,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_push', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -644,9 +644,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_fop_xch', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -642,9 +642,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_load', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -654,9 +654,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_multiple_instruments', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -642,9 +642,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_panning', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -3,17 +3,24 @@
extern void __stdcall _4klang_render();
extern int test_max_samples;
extern char test_name[];
int main(int argc, char* argv[]) {
FILE* f;
float* buf;
char filename[256];
int n;
float v;
int retval;
char test_name[] = TEST_NAME;
#ifndef GO4K_USE_16BIT_OUTPUT
float* buf;
float v;
buf = (float*)malloc(test_max_samples * 2 * sizeof(float));
#else
short* buf;
short v;
buf = (short*)malloc(test_max_samples * 2 * sizeof(short));
#endif
if (buf == NULL) {
printf("Could not allocate buffer\n");

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_gate', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_noise', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_pulse', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_sine', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -646,9 +646,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_stereo', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES

View File

@ -648,9 +648,6 @@ _go4k_delay_times
section .data
global _test_name
_test_name db 'test_vco_trisaw', 0 ; null terminated string
global _test_max_samples
_test_max_samples dd MAX_SAMPLES