test "test_embed" { "=> Static File Analyzer"; var data = embed "std.zc"; "Target File: 'std.zc'"; "File Size: {data.len} bytes"; ""; var lines: I32 = 1; var words: I32 = 0; var sum: U64 = 0; var in_word: bool = 0; "Analyzing content..."; var i: int = 0; while (i < data.len) { var c: char = data.data[i]; match c { '\n' => { lines++; in_word = 0; } ' ', '\t', '\r' => { in_word = 0; } _ => { if (!in_word) { words++; in_word = 1; } } } var b: U8 = c; sum = sum + b; i++; } ""; "*** Report ***"; "Total Lines: {lines}"; "Total Words: {words}"; "Checksum: 0x{sum:X} (Simple Sum)"; "Average Byte: {sum / data.len}"; ""; "Analysis successfully completed."; } test "typed_embed" { // String var s = embed "tests/features/embed_data.txt" as string; // "Hello World!\n" ? No newline in my file creation? // echo "Hello World!" > ... likely adds newline. // My previous tool 'write_to_file' wrote "Hello World!". It usually doesn't add newline unless specified? // Let's verify start content. if (s[0] != 'H') exit(101); // Fixed array var arr = embed "tests/features/embed_data.txt" as u8[5]; if (arr[0] != 'H') exit(102); if (arr[4] != 'o') exit(103); // Slice var sl = embed "tests/features/embed_data.txt" as u8[]; if (sl.len < 5) exit(104); if (sl.data[0] != 'H') exit(105); // Untyped regression var raw = embed "tests/features/embed_data.txt"; if (raw.len < 5) exit(106); if (raw.data[0] != 'H') exit(107); println "Typed embed tests passed"; }