Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2010-01-14 11:18:34 -06:00
commit 4ce5c3a155
5 changed files with 50 additions and 8 deletions

View File

@ -4,7 +4,7 @@ sbufs strings tools.test vectors words sequences.private
quotations classes classes.algebra classes.tuple.private
continuations growable namespaces hints alien.accessors
compiler.tree.builder compiler.tree.optimizer sequences.deep
compiler definitions generic.single shuffle ;
compiler definitions generic.single shuffle math.order ;
IN: compiler.tests.optimizer
GENERIC: xyz ( obj -- obj )
@ -445,5 +445,17 @@ M: object bad-dispatch-position-test* ;
[ 1024 bignum ] [ 10 [ 1 >bignum swap >fixnum shift ] compile-call dup class ] unit-test
! Not sure if I want to fix this...
! [ t [ [ f ] [ 3 ] if >fixnum ] compile-call ] [ no-method? ] must-fail-with
TUPLE: grid-mesh-tuple { length read-only } { step read-only } ;
: grid-mesh-test-case ( -- vertices )
1.0 1.0 { 2 } first /f [ /i 1 + ] keep grid-mesh-tuple boa
1 f <array>
[
[ drop length>> >fixnum 2 min ] 2keep
[
[ step>> 1 * ] dip
0 swap set-nth-unsafe
] 2curry times
] keep ;
[ { 0.5 } ] [ grid-mesh-test-case ] unit-test

View File

@ -1,4 +1,4 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel effects accessors math math.private
math.integers.private math.floats.private math.partial-dispatch
@ -23,11 +23,10 @@ IN: compiler.tree.propagation.known-words
{ + - * / }
[ { number number } "input-classes" set-word-prop ] each
{ /f < > <= >= u< u> u<= u>= }
{ /f /i mod < > <= >= u< u> u<= u>= }
[ { real real } "input-classes" set-word-prop ] each
{ /i mod /mod }
[ { rational rational } "input-classes" set-word-prop ] each
\ /mod { rational rational } "input-classes" set-word-prop
{ bitand bitor bitxor bitnot shift }
[ { integer integer } "input-classes" set-word-prop ] each

View File

@ -90,6 +90,8 @@ IN: compiler.tree.propagation.tests
[ float ] [ [ { float float } declare mod ] final-math-class ] unit-test
[ V{ integer float } ] [ [ { float float } declare [ /i ] keep ] final-classes ] unit-test
[ V{ fixnum } ] [ [ 255 bitand ] final-classes ] unit-test
[ V{ fixnum } ] [

View File

@ -1,6 +1,6 @@
! (c)Joe Groff bsd license
USING: alien.data.map fry generalizations kernel locals math.vectors
math.vectors.conversion math math.vectors.simd sequences
math.vectors.conversion math math.vectors.simd math.ranges sequences
specialized-arrays tools.test ;
FROM: alien.c-types => uchar short int float ;
SPECIALIZED-ARRAYS: int float float-4 uchar-16 ;
@ -145,3 +145,11 @@ CONSTANT: plane-count 4
B{ 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 165 }
fold-rgba-planes
] unit-test
: data-map-compiler-bug-test ( n -- byte-array )
[ 0.0 1.0 1.0 ] dip /f <range>
[ ] data-map( object -- float ) ;
[ float-array{ 0.0 0.5 1.0 } ]
[ 2 data-map-compiler-bug-test byte-array>float-array ]
unit-test

View File

@ -0,0 +1,21 @@
IN: grid-meshes.tests
USING: alien.c-types grid-meshes grid-meshes.private
specialized-arrays tools.test ;
SPECIALIZED-ARRAY: float
[
float-array{
0.0 0.0 0.0 1.0
0.0 0.0 0.5 1.0
0.5 0.0 0.0 1.0
0.5 0.0 0.5 1.0
1.0 0.0 0.0 1.0
1.0 0.0 0.5 1.0
0.0 0.0 0.5 1.0
0.0 0.0 1.0 1.0
0.5 0.0 0.5 1.0
0.5 0.0 1.0 1.0
1.0 0.0 0.5 1.0
1.0 0.0 1.0 1.0
}
] [ { 2 2 } vertex-array byte-array>float-array ] unit-test