summaryrefslogtreecommitdiff
path: root/tests/piece-table.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/piece-table.scm')
-rw-r--r--tests/piece-table.scm101
1 files changed, 52 insertions, 49 deletions
diff --git a/tests/piece-table.scm b/tests/piece-table.scm
index c8d1280..620b50c 100644
--- a/tests/piece-table.scm
+++ b/tests/piece-table.scm
@@ -1,67 +1,70 @@
(import (srfi 64)
- (scheme base)
- (par piece-table))
+ (scheme small)
+ (par %piece-table-all))
;; https://srfi.schemers.org/srfi-64/srfi-64.html
(test-begin "index")
(define table (make-piece-table "HOLA"))
+ (split-piece! (piece-next (piece-table-sentinel table)) 2) ;;Spice up the test
(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-equal #\O (piece-table-index table 1))
(test-end "index")
(test-begin "length")
(define table (make-piece-table "HOLA"))
- (test-equal 4 (piece-table-text-length table))
+ (test-equal 4 (piece-table-length table))
(test-end "length")
-(test-begin "insert")
- (define table (make-piece-table "HOLA"))
- (piece-table-insert! table 4 "9" 'normal)
- (test-equal #\9 (piece-table-index table 4))
- (piece-table-insert! table 5 "0" 'normal)
- (test-equal #\0 (piece-table-index table 5))
- (test-equal "HOLA90" (piece-table->string table))
- (piece-table-insert! table 5 "1" 'normal)
- (test-equal "HOLA910" (piece-table->string table))
-(test-end "insert")
-
-(test-begin "substring")
- (parameterize ((add-buffer-length 10))
- (define table (make-piece-table "1234567890"))
- (test-equal "1234567890" (piece-table-substring table 0 10))
- (test-equal "67890" (piece-table-substring table 5 10))
- (piece-table-insert! table 6 "X" 'normal)
- (test-equal "6X78" (piece-table-substring table 5 9)))
-(test-end "substring")
-
-(test-begin "delete")
- (define table (make-piece-table "HOLA SOY EKAITZ"))
- (piece-table-delete! table 4 1)
- (test-equal "HOLASOY EKAITZ" (piece-table->string table))
- (piece-table-delete! table 0 1)
- (test-equal "OLASOY EKAITZ" (piece-table->string table))
- (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 "for-each")
-(test-begin "find")
- (define table (make-piece-table "1234567890"))
- (test-equal 8 (piece-table-find table #\9 0))
-(test-end "find")
+;(test-begin "insert")
+; (define table (make-piece-table "HOLA"))
+; (piece-table-insert! table 4 "9" 'normal)
+; (test-equal #\9 (piece-table-index table 4))
+; (piece-table-insert! table 5 "0" 'normal)
+; (test-equal #\0 (piece-table-index table 5))
+; (test-equal "HOLA90" (piece-table->string table))
+; (piece-table-insert! table 5 "1" 'normal)
+; (test-equal "HOLA910" (piece-table->string table))
+;(test-end "insert")
+;
+;(test-begin "substring")
+; (parameterize ((add-buffer-length 10))
+; (define table (make-piece-table "1234567890"))
+; (test-equal "1234567890" (piece-table-substring table 0 10))
+; (test-equal "67890" (piece-table-substring table 5 10))
+; (piece-table-insert! table 6 "X" 'normal)
+; (test-equal "6X78" (piece-table-substring table 5 9)))
+;(test-end "substring")
+;
+;(test-begin "delete")
+; (define table (make-piece-table "HOLA SOY EKAITZ"))
+; (piece-table-delete! table 4 1)
+; (test-equal "HOLASOY EKAITZ" (piece-table->string table))
+; (piece-table-delete! table 0 1)
+; (test-equal "OLASOY EKAITZ" (piece-table->string table))
+; (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 "for-each")
+;
+;(test-begin "find")
+; (define table (make-piece-table "1234567890"))
+; (test-equal 8 (piece-table-find table #\9 0))
+;(test-end "find")