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

#include "../src/bio_state.h"

int main(int argc, char **argv) {
    const char *gguf = argc > 1 ? argv[1] : "tests/fixtures/minimal-q4.gguf";
    const char *state_path = argc > 2 ? argv[2] : "tests/fixtures/minimal.bdst";
    const char *delta_path = argc > 3 ? argv[3] : "tests/fixtures/minimal.bdl";
    bio_state_table state;
    if (bio_state_create(gguf, state_path, delta_path) != BIO_OK) {
        fprintf(stderr, "state create failed\n");
        return 1;
    }
    if (bio_state_load(state_path, &state) != BIO_OK) {
        fprintf(stderr, "state load failed\n");
        return 1;
    }
    if (state.magic != BIO_BDST_MAGIC || strcmp(state.gguf_path, gguf) != 0 ||
        strcmp(state.delta_path, delta_path) != 0 || state.tensor_count == 0u) {
        fprintf(stderr, "state contents invalid\n");
        return 1;
    }
    puts("bio-tests: bdst state table ok");
    return 0;
}
