From 26892394d6999fca9be6975b0910158fdf8a9fff Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 23 Jan 2024 15:29:23 +0100 Subject: par: piece-table: add for-each --- tests/piece-table.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3