summaryrefslogtreecommitdiff
path: root/tests/features/test_embed.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 23:59:54 +0000
commitdcfdc053cb5f9fb4d5eac0a2233c75126b7a8188 (patch)
treef34f30b382fa22d6fd0af46875a5b4b26d00feff /tests/features/test_embed.zc
parenta918df69269a39ef7350a645b5db025d66ecb18a (diff)
Added some of the tests.
Diffstat (limited to 'tests/features/test_embed.zc')
-rw-r--r--tests/features/test_embed.zc57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/features/test_embed.zc b/tests/features/test_embed.zc
new file mode 100644
index 0000000..f6d9468
--- /dev/null
+++ b/tests/features/test_embed.zc
@@ -0,0 +1,57 @@
+
+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.";
+
+}