// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef
const std = @import("std");
const testing = std.testing;
const kreuzberg = @import("kreuzberg");

// Suppress C++ global destructor aborts that break zig's --listen=- IPC
extern "c" fn signal(sig: i32, handler: usize) usize;
var _abort_handler_installed: bool = false;
fn suppress_abort() void {
    if (!_abort_handler_installed) {
        // SIGABRT = 6 on POSIX; SIG_IGN = 1
        _ = signal(6, 1);
        _abort_handler_installed = true;
    }
}

// E2e tests for category: embeddings

test "embed_texts_different_preset" {
    // embed_texts: multilingual preset
    suppress_abort();
    const _result_json = try kreuzberg.embed_texts("[\"Hello world\",\"Test\"]", "{\"model\":{\"name\":\"multilingual\",\"type\":\"preset\"}}");
    defer std.heap.c_allocator.free(_result_json);
}

test "get_embedding_preset_known" {
    // get_embedding_preset: known preset
    suppress_abort();
    _ = try kreuzberg.get_embedding_preset("balanced");
}

test "get_embedding_preset_nominal" {
    // get_embedding_preset: nominal case
    suppress_abort();
    _ = try kreuzberg.get_embedding_preset("balanced");
}

test "get_embedding_preset_unknown" {
    // get_embedding_preset: unknown preset fails
    suppress_abort();
    const result = try kreuzberg.get_embedding_preset("nonexistent-xyz");
    try testing.expect(result == null);
}

test "list_embedding_presets_sanity" {
    // list_embedding_presets: returns at least one
    suppress_abort();
    const result = try kreuzberg.list_embedding_presets();
    try testing.expect(result.len > 0);
}
