summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-02-06 22:24:03 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-02-06 22:24:03 +0100
commitde23bd8fa5db84424faed6326c9a57c35c20a955 (patch)
treec4ab9258fe8f355b35b400f9a7db15944e22de0c /tests
parent92e82c76b97254a4fb70f09f45192b163962febb (diff)
par: piece-table: Implement sentinel pieces
Now the pieces are a circular doubly linked list with a sentinel piece
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 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")