#include <stdio.h>
#include <string.h>

#include "bio/bio.h"

int main(int argc, char **argv) {
    const char *program = argc > 1 ? argv[1] : "examples/phase1_all_opcodes.bio";
    const char *version = NULL;
    if (bio_v1_init() != BIO_OK) {
        fprintf(stderr, "bio_v1_init failed\n");
        return 1;
    }
    version = bio_v1_version();
    if (version == NULL || strstr(version, "phase4") == NULL) {
        fprintf(stderr, "unexpected version: %s\n", version == NULL ? "(null)" : version);
        return 1;
    }
    if (strcmp(bio_v1_active_variant("opcode_dispatch"), "direct_function_pointer") != 0) {
        fprintf(stderr, "opcode dispatch variant mismatch\n");
        return 1;
    }
    if (bio_v1_run_file(program) != BIO_OK) {
        fprintf(stderr, "phase4 program failed: %s\n", program);
        return 1;
    }
    puts("bio-tests: phase4 learn/chat native path ok");
    return 0;
}
