add some unit tests for reshaping tuples with initial-quot: slots
parent
99bfeb62c4
commit
258abe31ab
core/classes/tuple
|
@ -1,11 +1,12 @@
|
|||
USING: definitions generic kernel kernel.private math math.constants
|
||||
parser sequences tools.test words assocs namespaces quotations
|
||||
sequences.private classes continuations generic.single
|
||||
generic.standard effects classes.tuple classes.tuple.private arrays
|
||||
vectors strings compiler.units accessors classes.algebra calendar
|
||||
prettyprint io.streams.string splitting summary columns math.order
|
||||
classes.private slots slots.private eval see words.symbol
|
||||
compiler.errors parser.notes ;
|
||||
USING: accessors arrays assocs calendar classes classes.algebra
|
||||
classes.private classes.tuple classes.tuple.private columns
|
||||
compiler.errors compiler.units continuations definitions
|
||||
effects eval generic generic.single generic.standard grouping
|
||||
io.streams.string kernel kernel.private math math.constants
|
||||
math.order namespaces parser parser.notes prettyprint
|
||||
quotations random see sequences sequences.private slots
|
||||
slots.private splitting strings summary threads tools.test
|
||||
vectors vocabs words words.symbol ;
|
||||
IN: classes.tuple.tests
|
||||
|
||||
TUPLE: rect x y w h ;
|
||||
|
@ -421,7 +422,6 @@ TUPLE: redefinition-problem-2 ;
|
|||
[ t ] [ 3 redefinition-problem'? ] unit-test
|
||||
|
||||
! Hardcore unit tests
|
||||
USE: threads
|
||||
|
||||
\ thread "slots" word-prop "slots" set
|
||||
|
||||
|
@ -439,8 +439,6 @@ USE: threads
|
|||
] with-compilation-unit
|
||||
] unit-test
|
||||
|
||||
USE: vocabs
|
||||
|
||||
\ vocab "slots" word-prop "slots" set
|
||||
|
||||
[ ] [
|
||||
|
@ -731,3 +729,18 @@ DEFER: redefine-tuple-twice
|
|||
[ ] [ "IN: classes.tuple.tests TUPLE: redefine-tuple-twice ;" eval( -- ) ] unit-test
|
||||
|
||||
[ t ] [ \ redefine-tuple-twice symbol? ] unit-test
|
||||
|
||||
TUPLE: lucky-number { n initial-quot: [ 64 random-bits ] } ;
|
||||
SLOT: winner?
|
||||
|
||||
[ f ] [ 100 [ lucky-number new ] replicate all-equal? ] unit-test
|
||||
|
||||
! Reshaping initial-quot:
|
||||
lucky-number new dup n>> 2array "luckiest-number" set
|
||||
|
||||
[ t ] [ "luckiest-number" get first2 [ n>> ] dip = ] unit-test
|
||||
|
||||
[ ] [ "USING: accessors random ; IN: classes.tuple.tests TUPLE: lucky-number { n initial-quot: [ 64 random-bits ] } { winner? initial-quot: [ t ] } ;" eval( -- ) ] unit-test
|
||||
|
||||
[ t ] [ "luckiest-number" get first2 [ n>> ] dip = ] unit-test
|
||||
[ t ] [ "luckiest-number" get first winner?>> ] unit-test
|
||||
|
|
Loading…
Reference in New Issue