package benchmarks

import (
	"os"
	"testing"

	"github.com/jfraeys/fetch_ml/internal/worker"
)

// TestNativeIntegration verifies native libraries are callable
func TestNativeIntegration(t *testing.T) {
	// Check SIMD detection works
	simdName := worker.GetSIMDImplName()
	t.Logf("SIMD implementation: %s", simdName)

	simdAvailable := worker.HasSIMDSHA256()
	t.Logf("SIMD available: %v", simdAvailable)

	// Create test directory
	tmpDir := t.TempDir()
	if err := os.WriteFile(tmpDir+"/test.txt", []byte("hello world"), 0644); err != nil {
		t.Fatal(err)
	}

	// Test hashing works
	hash, err := worker.DirOverallSHA256Hex(tmpDir)
	if err != nil {
		t.Fatalf("Hash failed: %v", err)
	}
	if len(hash) != 64 {
		t.Fatalf("Expected 64 char hash, got %d: %s", len(hash), hash)
	}
	t.Logf("Hash result: %s", hash)
}
