summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-01-23 15:29:23 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-01-23 15:29:23 +0100
commit26892394d6999fca9be6975b0910158fdf8a9fff (patch)
tree9fa2a691d8ba7de5d925e532c1b83e148db011af /tests
parent73e28d46fd5aeb71677eec8e785029b26f6385ef (diff)
par: piece-table: add for-each
Diffstat (limited to 'tests')
-rw-r--r--tests/piece-table.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/piece-table.scm b/tests/piece-table.scm
index 19bd107..453229e 100644
--- a/tests/piece-table.scm
+++ b/tests/piece-table.scm
@@ -47,3 +47,16 @@
(piece-table-delete! table 12 1)
(test-equal "OLASOY EKAIT" (piece-table->string table))
(test-end "delete")
+
+(test-begin "for-each")
+ (define table (make-piece-table "12346890"))
+ (piece-table-insert! table 4 "5" 'normal)
+ (test-equal "123456890" (piece-table->string table))
+ (piece-table-insert! table 6 "7" 'normal)
+ (test-equal "1234567890" (piece-table->string table))
+ (piece-table-for-each table
+ (lambda (c i p)
+ (test-equal c (string-ref "1234567890" i)))
+ 0
+ 10)
+(test-end)