gbasm: add support for generating source input
By adding an "init" function per test, it is easier to generate code that would be laborious to write by hand.
This commit is contained in:
@@ -36,6 +36,10 @@ static void run_test(const void *test_data)
|
|||||||
int rc;
|
int rc;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
if (test->init != NULL) {
|
||||||
|
test->init();
|
||||||
|
}
|
||||||
|
|
||||||
src = strdup(test->asm_source);
|
src = strdup(test->asm_source);
|
||||||
|
|
||||||
memset(program, 0, sizeof(program));
|
memset(program, 0, sizeof(program));
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct gbasm_test {
|
struct gbasm_test {
|
||||||
|
void (*init)(void);
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *asm_source;
|
const char *asm_source;
|
||||||
const uint8_t *expected_output;
|
const uint8_t *expected_output;
|
||||||
const int expected_output_len;
|
int expected_output_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gbasm_tests {
|
struct gbasm_tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user