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

#include "../src/bio_forward.h"

int main(void) {
    uint8_t data[512];
    uint32_t tokens[3] = {'h', 'i', '!'};
    bio_gguf_model model;
    bio_forward_result result;
    for (uint32_t i = 0; i < sizeof(data); ++i) {
        data[i] = (uint8_t)(i * 17u);
    }
    memset(&model, 0, sizeof(model));
    model.registered_tensor_count = 1u;
    strcpy(model.tensors[0].name, "token_embd.weight");
    model.tensors[0].data = data;
    model.tensors[0].byte_size = sizeof(data);
    model.tensors[0].ggml_type = BIO_GGUF_TYPE_Q4_K;
    model.tensors[0].int4_compatible = 1u;
    if (bio_forward_next_token(&model, tokens, 3u, 123u, &result) != BIO_OK) {
        fprintf(stderr, "forward failed\n");
        return 1;
    }
    if (result.token >= BIO_FORWARD_LOGITS || result.executed_ops == 0u) {
        fprintf(stderr, "forward result invalid\n");
        return 1;
    }
    puts("bio-tests: native forward sampler ok");
    return 0;
}
