summaryrefslogtreecommitdiff
path: root/tigrou/linked-list/linked-list.tig
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tigrou/linked-list/linked-list.tig
add: added projectsHEADmain
Diffstat (limited to 'tigrou/linked-list/linked-list.tig')
-rw-r--r--tigrou/linked-list/linked-list.tig24
1 files changed, 24 insertions, 0 deletions
diff --git a/tigrou/linked-list/linked-list.tig b/tigrou/linked-list/linked-list.tig
new file mode 100644
index 0000000..04c8a29
--- /dev/null
+++ b/tigrou/linked-list/linked-list.tig
@@ -0,0 +1,24 @@
+let
+ import "linked-list.tih"
+ var list := node { value = 0, next = nil }
+
+ function test_lists(expected: string) =
+ (
+ print(concat("Expected : { ", expected));
+ print(" }\ngot : { ");
+ display(list);
+ print(" }\n\n")
+ )
+in
+ test_lists("0");
+
+ print("Adding '1' ...\n");
+ append(list, 1);
+
+ test_lists("0 -> 1");
+
+ print("Adding '2' ...\n");
+ append(list, 2);
+
+ test_lists("0 -> 1 -> 2")
+end