X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=extra%2Fassocs%2Fextras%2Fextras-tests.factor;h=65aaf7798c4d5a0082ee40ce568dba8997946db9;hp=25ded3f642d82048654a67c6bd4e249fb5fba32e;hb=46bc9c866f85354570baec691b6a858c0c46d7aa;hpb=4c1ea52d1531b492ce880e77fb3e9623a900fdf1 diff --git a/extra/assocs/extras/extras-tests.factor b/extra/assocs/extras/extras-tests.factor index 25ded3f642..65aaf7798c 100644 --- a/extra/assocs/extras/extras-tests.factor +++ b/extra/assocs/extras/extras-tests.factor @@ -201,21 +201,36 @@ USING: arrays assocs.extras kernel math math.order sequences tools.test ; [ [ drop even? ] [ 2array ] 2bi ] collect-assoc-by ] unit-test + { - H{ { t V{ 10 20 30 } } { f V{ 41 } } } + H{ { t V{ 10 21 } } { f V{ 30 41 } } } } [ - { { 10 100 } { 20 200 } { 30 300 } { 41 401 } } - [ even? ] collect-key-by -] unit-test + { { 10 100 } { 21 200 } { 30 301 } { 41 401 } } + [ nip even? ] collect-key-by + ] unit-test { - H{ { t V{ 100 200 300 } } { f V{ 401 } } } + H{ { t V{ 10 30 } } { f V{ 21 41 } } } } [ - { { 10 100 } { 20 200 } { 30 300 } { 41 401 } } - [ even? ] collect-value-by -] unit-test + { { 10 100 } { 21 200 } { 30 301 } { 41 401 } } + [ drop even? ] collect-key-by + ] unit-test +{ + H{ { t V{ 100 200 } } { f V{ 301 401 } } } +} [ + { { 10 100 } { 21 200 } { 30 301 } { 41 401 } } + [ nip even? ] collect-value-by + ] unit-test + +{ + H{ { t V{ 100 301 } } { f V{ 200 401 } } } +} [ + { { 10 100 } { 21 200 } { 30 301 } { 41 401 } } + [ drop even? ] collect-value-by + ] unit-test + { H{ { 1 V{ 10 20 30 40 50 60 } } @@ -244,7 +259,7 @@ USING: arrays assocs.extras kernel math math.order sequences tools.test ; } } [ { { 10 100 } { 20 200 } { 30 300 } { 41 401 } } - [ dup 1 + 2array ] collect-key-by-multi + [ drop dup 1 + 2array ] collect-key-by-multi ] unit-test @@ -261,7 +276,7 @@ USING: arrays assocs.extras kernel math math.order sequences tools.test ; } } [ { { 10 100 } { 20 200 } { 30 300 } { 41 401 } } - [ dup 1 + 2array ] collect-value-by-multi + [ nip dup 1 + 2array ] collect-value-by-multi ] unit-test