#!/usr/bin/env herodo
// Test: Utility Functions
// Tests utility functions like sleep and string operations

print("=== Test: Utility Functions ===");

// Test 1: Sleep function
print("\n[TEST 1] Sleep function");
print("  Sleeping for 100ms...");
let start = 0;
sleep(100);
print("✓ Sleep completed");

// Test 2: String concatenation
print("\n[TEST 2] String operations");
let str1 = "Hello";
let str2 = "World";
let combined = str1 + " " + str2;
print("  Combined: " + combined);
print("✓ String concatenation works");

// Test 3: Number to string conversion
print("\n[TEST 3] Number to string conversion");
let num = 42;
let str = "Number: " + num;
print("  " + str);
print("✓ Number to string conversion works");

// Test 4: Path construction
print("\n[TEST 4] Path construction");
let base_path = "/tmp";
let file_name = "test.img";
let full_path = base_path + "/" + file_name;
print("  Full path: " + full_path);
print("✓ Path construction works");

// Test 5: Loop and counter
print("\n[TEST 5] Loop and counter");
let count = 0;
while count < 5 {
    count += 1;
}
print("  Final count: " + count);
print("✓ Loop and counter work");

// Test 6: Array operations
print("\n[TEST 6] Array operations");
let arr = [];
arr.push("item1");
arr.push("item2");
arr.push("item3");
print("  Array length: " + arr.len());
print("✓ Array operations work");

// Test 7: Conditional logic
print("\n[TEST 7] Conditional logic");
let value = 10;
if value > 5 {
    print("  Value is greater than 5");
    print("✓ Conditional logic works");
} else {
    print("  ✗ Conditional logic failed");
}

// Test 8: Boolean operations
print("\n[TEST 8] Boolean operations");
let flag1 = true;
let flag2 = false;
if flag1 && !flag2 {
    print("✓ Boolean operations work");
} else {
    print("✗ Boolean operations failed");
}

// Test 9: Variable scope
print("\n[TEST 9] Variable scope");
let outer = "outer";
{
    let inner = "inner";
    print("  Inner scope: " + inner);
}
print("  Outer scope: " + outer);
print("✓ Variable scope works");

// Test 10: Function-like builder pattern
print("\n[TEST 10] Builder pattern chaining");
let config = RuntimeBuilder()
    .api_socket("/tmp/test.sock")
    .seccomp(true)
    .landlock(true);
print("✓ Builder pattern chaining works");

print("\n=== All Utility Function tests passed! ===");
