From de23bd8fa5db84424faed6326c9a57c35c20a955 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 6 Feb 2024 22:24:03 +0100 Subject: par: piece-table: Implement sentinel pieces Now the pieces are a circular doubly linked list with a sentinel piece --- tests/piece-table.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/piece-table.scm') diff --git a/tests/piece-table.scm b/tests/piece-table.scm index 76176a9..62ff11d 100644 --- a/tests/piece-table.scm +++ b/tests/piece-table.scm @@ -7,9 +7,17 @@ (test-begin "index") (define table (make-piece-table "HOLA")) + (test-equal #\H (piece-table-index table 0)) + (test-equal #\O (piece-table-index table 1)) (test-equal #\L (piece-table-index table 2)) + (test-equal #\A (piece-table-index table 3)) (test-end "index") +(test-begin "length") + (define table (make-piece-table "HOLA")) + (test-equal 4 (piece-table-text-length table)) +(test-end "length") + (test-begin "insert") (define table (make-piece-table "HOLA")) (piece-table-insert! table 4 "9" 'normal) @@ -61,3 +69,8 @@ 0 10) (test-end "for-each") + +(test-begin "find") + (define table (make-piece-table "1234567890")) + (test-equal 8 (piece-table-find table #\9 0)) +(test-end "find") -- cgit v1.2.3