Skip to content

Commit

Permalink
test(assoc): various words
Browse files Browse the repository at this point in the history
delete-at*, ?delete-at, assoc-empty?, assoc=,  assoc-find, subtitute

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg authored and mrjbq7 committed May 23, 2024
1 parent 74a4be3 commit b16eed9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/assocs/assocs-tests.factor
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,23 @@ unit-test
{ H{ { 1 4 } } } [ H{ { 1 2 } } 1 over [ sq ] ?change-at ] unit-test
{ H{ { 1 2 } } } [ H{ { 1 2 } } 2 over [ sq ] ?change-at ] unit-test
{ H{ { 1 3 } } } [ H{ { 1 2 } } 3 1 pick [ drop dup ] ?change-at drop ] unit-test

{ H{ } 4 t } [ H{ { 1 4 } } 1 over delete-at* ] unit-test
{ H{ { 1 4 } } f f } [ H{ { 1 4 } } 3 over delete-at* ] unit-test

{ H{ } 4 t } [ H{ { 1 4 } } 1 over ?delete-at ] unit-test
{ H{ { 1 4 } } 3 f } [ H{ { 1 4 } } 3 over ?delete-at ] unit-test

{ t } [ H{ } assoc-empty? ] unit-test
{ f } [ H{ { 1 2 } } assoc-empty? ] unit-test

{ t } [ H{ { 1 2 } } H{ { 1 2 } } assoc= ] unit-test
{ f } [ H{ { 1 2 } } { } assoc= ] unit-test
{ t } [ H{ { 1 2 } } { { 1 2 } } assoc= ] unit-test

{ f f f } [ { } [ "impossible" ] assoc-find ] unit-test
{ 1 0 t } [ { { 1 0 } { 4 5 } } [ > ] assoc-find ] unit-test

{ { 1 2 } } [ { 1 2 } H{ } substitute ] unit-test
{ { 5 2 10 } } [ { 1 2 3 } H{ { 1 5 } { 3 10 } } substitute ] unit-test
{ { 2 3 3 } } [ { 1 2 3 } H{ { 1 2 } { 2 3 } } substitute ] unit-test

0 comments on commit b16eed9

Please sign in to comment.