1 USING: assocs kernel gap-buffer.cursortree tools.test sequences trees
3 IN: gap-buffer.cursortree.tests
5 [ t ] [ "this is a test string" <cursortree> 0 <left-cursor> at-beginning? ] unit-test
6 [ t ] [ "this is a test string" <cursortree> dup length <left-cursor> at-end? ] unit-test
7 [ 3 ] [ "this is a test string" <cursortree> 3 <left-cursor> cursor-pos ] unit-test
8 [ CHAR: i ] [ "this is a test string" <cursortree> 3 <left-cursor> element< ] unit-test
9 [ CHAR: s ] [ "this is a test string" <cursortree> 3 <left-cursor> element> ] unit-test
10 [ t ] [ "this is a test string" <cursortree> 3 <left-cursor> CHAR: a over set-element< CHAR: t over set-element> cursor-tree "that is a test string" sequence= ] unit-test
11 [ 0 ] [ "this is a test string" <cursortree> dup dup 3 <left-cursor> remove-cursor cursors length ] unit-test
12 [ t ] [ "this is a test string" <cursortree> 3 <left-cursor> 8 over set-cursor-pos dup 1array swap cursor-tree cursors sequence= ] unit-test
13 [ "this is no longer a test string" ] [ "this is a test string" <cursortree> 8 <left-cursor> "no longer " over insert cursor-tree >string ] unit-test
14 [ "refactor" ] [ "factor" <cursortree> 0 <left-cursor> CHAR: e over insert CHAR: r over insert cursor-tree >string ] unit-test
15 [ "refactor" ] [ "factor" <cursortree> 0 <right-cursor> CHAR: r over insert CHAR: e over insert cursor-tree >string ] unit-test
16 [ "this a test string" 5 ] [ "this is a test string" <cursortree> 5 <right-cursor> dup delete> dup delete> dup delete> dup cursor-tree >string swap cursor-pos ] unit-test
17 [ "this a test string" 5 ] [ "this is a test string" <cursortree> 8 <right-cursor> dup delete< dup delete< dup delete< dup cursor-tree >string swap cursor-pos ] unit-test