(import (srfi 64) (scheme base) (par piece-table)) ;; https://srfi.schemers.org/srfi-64/srfi-64.html (test-begin "index") (define table (make-piece-table "HOLA")) (test-equal #\L (piece-table-index table 2)) (test-end "index") (test-begin "insert") (define table (make-piece-table "HOLA")) (piece-table-insert! table 4 "9" 'normal) (piece-table-insert! table 5 "0" 'normal) (test-equal #\9 (piece-table-index table 4)) (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 "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")