Some unit test fixes

db4
Slava Pestov 2008-06-30 03:57:00 -05:00
parent fb8723bce1
commit 77c4d97785
18 changed files with 38 additions and 34 deletions

View File

@ -1,4 +1,4 @@
USING: arrays kernel sequences sequences.private growable USING: accessors arrays kernel sequences sequences.private growable
tools.test vectors layouts system math vectors.private ; tools.test vectors layouts system math vectors.private ;
IN: arrays.tests IN: arrays.tests
@ -11,7 +11,7 @@ IN: arrays.tests
[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } >vector ] unit-test [ V{ "a" "b" "c" } ] [ { "a" "b" "c" } >vector ] unit-test
[ f ] [ { "a" "b" "c" } dup >array eq? ] unit-test [ f ] [ { "a" "b" "c" } dup >array eq? ] unit-test
[ t ] [ { "a" "b" "c" } dup { } like eq? ] unit-test [ t ] [ { "a" "b" "c" } dup { } like eq? ] unit-test
[ t ] [ { "a" "b" "c" } dup dup length array>vector underlying eq? ] unit-test [ t ] [ { "a" "b" "c" } dup dup length array>vector underlying>> eq? ] unit-test
[ V{ "a" "b" "c" } ] [ { "a" "b" "c" } V{ } like ] unit-test [ V{ "a" "b" "c" } ] [ { "a" "b" "c" } V{ } like ] unit-test
[ { "a" "b" "c" } ] [ { "a" } { "b" "c" } append ] unit-test [ { "a" "b" "c" } ] [ { "a" } { "b" "c" } append ] unit-test
[ { "a" "b" "c" "d" "e" } ] [ { "a" "b" "c" "d" "e" } ]

View File

@ -1,4 +1,4 @@
USING: arrays compiler.units kernel kernel.private math USING: accessors arrays compiler.units kernel kernel.private math
math.constants math.private sequences strings tools.test words math.constants math.private sequences strings tools.test words
continuations sequences.private hashtables.private byte-arrays continuations sequences.private hashtables.private byte-arrays
strings.private system random layouts vectors.private strings.private system random layouts vectors.private

View File

@ -1,7 +1,7 @@
IN: compiler.tests IN: compiler.tests
USING: compiler compiler.units tools.test math parser kernel USING: accessors compiler compiler.units tools.test math parser
sequences sequences.private classes.mixin generic definitions kernel sequences sequences.private classes.mixin generic
arrays words assocs ; definitions arrays words assocs ;
GENERIC: method-redefine-test ( a -- b ) GENERIC: method-redefine-test ( a -- b )

View File

@ -1,7 +1,7 @@
IN: compiler.tests IN: compiler.tests
USING: compiler compiler.units tools.test math parser kernel USING: accessors compiler compiler.units tools.test math parser
sequences sequences.private classes.mixin generic definitions kernel sequences sequences.private classes.mixin generic
arrays words assocs ; definitions arrays words assocs ;
GENERIC: sheeple ( obj -- x ) GENERIC: sheeple ( obj -- x )

View File

@ -235,6 +235,6 @@ M: f single-combination-test-2 single-combination-test-4 ;
10 [ 10 [
[ "compiler.tests.foo" forget-vocab ] with-compilation-unit [ "compiler.tests.foo" forget-vocab ] with-compilation-unit
[ t ] [ [ t ] [
"USING: prettyprint words ; IN: compiler.tests.foo : (recursive) ( -- ) (recursive) (recursive) ; inline : recursive ( -- ) (recursive) ; \\ (recursive) compiled>>" eval "USING: prettyprint words accessors ; IN: compiler.tests.foo : (recursive) ( -- ) (recursive) (recursive) ; inline : recursive ( -- ) (recursive) ; \\ (recursive) compiled>>" eval
] unit-test ] unit-test
] times ] times

View File

@ -1,5 +1,5 @@
! Black box testing of templating optimization ! Black box testing of templating optimization
USING: arrays compiler kernel kernel.private math USING: accessors arrays compiler kernel kernel.private math
hashtables.private math.private namespaces sequences hashtables.private math.private namespaces sequences
sequences.private tools.test namespaces.private slots.private sequences.private tools.test namespaces.private slots.private
sequences.private byte-arrays alien alien.accessors layouts sequences.private byte-arrays alien alien.accessors layouts
@ -138,7 +138,7 @@ unit-test
0 swap hellish-bug-2 drop ; 0 swap hellish-bug-2 drop ;
[ ] [ [ ] [
H{ { 1 2 } { 3 4 } } dup hash-array H{ { 1 2 } { 3 4 } } dup array>>
[ 0 swap hellish-bug-2 drop ] compile-call [ 0 swap hellish-bug-2 drop ] compile-call
] unit-test ] unit-test

View File

@ -83,12 +83,14 @@ IN: cpu.x86.intrinsics
{ {
[ %slot-literal-known-tag "val" operand MOV generate-write-barrier ] H{ [ %slot-literal-known-tag "val" operand MOV generate-write-barrier ] H{
{ +input+ { { f "val" } { f "obj" known-tag } { [ small-slot? ] "n" } } } { +input+ { { f "val" } { f "obj" known-tag } { [ small-slot? ] "n" } } }
{ +clobber+ { "obj" } }
} }
} }
! Slot number is literal ! Slot number is literal
{ {
[ %slot-literal-any-tag "val" operand MOV generate-write-barrier ] H{ [ %slot-literal-any-tag "val" operand MOV generate-write-barrier ] H{
{ +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } } { +input+ { { f "val" } { f "obj" } { [ small-slot? ] "n" } } }
{ +clobber+ { "obj" } }
} }
} }
! Slot number in a register ! Slot number in a register

View File

@ -1,4 +1,4 @@
USING: alien arrays definitions generic generic.standard USING: accessors alien arrays definitions generic generic.standard
generic.math assocs hashtables io kernel math namespaces parser generic.math assocs hashtables io kernel math namespaces parser
prettyprint sequences strings tools.test vectors words prettyprint sequences strings tools.test vectors words
quotations classes classes.algebra continuations layouts quotations classes classes.algebra continuations layouts

View File

@ -1,4 +1,4 @@
USING: arrays generic inference inference.backend USING: accessors arrays generic inference inference.backend
inference.dataflow kernel classes kernel.private math inference.dataflow kernel classes kernel.private math
math.parser math.private namespaces namespaces.private parser math.parser math.private namespaces namespaces.private parser
sequences strings vectors words quotations effects tools.test sequences strings vectors words quotations effects tools.test

View File

@ -51,4 +51,4 @@ C: <color> color
[ bad-new-test ] must-infer [ bad-new-test ] must-infer
[ bad-new-test ] [ T{ not-a-tuple-class f V{ } } = ] must-fail-with [ bad-new-test ] must-fail

View File

@ -1,4 +1,4 @@
USING: math math.bitfields tools.test kernel words ; USING: accessors math math.bitfields tools.test kernel words ;
IN: math.bitfields.tests IN: math.bitfields.tests
[ 0 ] [ { } bitfield ] unit-test [ 0 ] [ { } bitfield ] unit-test
@ -14,4 +14,4 @@ IN: math.bitfields.tests
[ 3 ] [ foo ] unit-test [ 3 ] [ foo ] unit-test
[ 3 ] [ { a b } flags ] unit-test [ 3 ] [ { a b } flags ] unit-test
[ t ] [ \ foo compiled>> ] unit-test \ foo must-infer

View File

@ -1,4 +1,4 @@
USING: arrays kernel kernel.private math namespaces USING: accessors arrays kernel kernel.private math namespaces
sequences sequences.private strings tools.test vectors sequences sequences.private strings tools.test vectors
continuations random growable classes ; continuations random growable classes ;
IN: vectors.tests IN: vectors.tests
@ -70,14 +70,14 @@ IN: vectors.tests
[ "funky" ] [ "funny-stack" get pop ] unit-test [ "funky" ] [ "funny-stack" get pop ] unit-test
[ t ] [ [ t ] [
V{ 1 2 3 4 } dup underlying length V{ 1 2 3 4 } dup underlying>> length
>r clone underlying length r> >r clone underlying>> length r>
= =
] unit-test ] unit-test
[ f ] [ [ f ] [
V{ 1 2 3 4 } dup clone V{ 1 2 3 4 } dup clone
[ underlying ] bi@ eq? [ underlying>> ] bi@ eq?
] unit-test ] unit-test
[ 0 ] [ [ 0 ] [

View File

@ -365,7 +365,7 @@ M: lambda-word definition
"lambda" word-prop body>> ; "lambda" word-prop body>> ;
M: lambda-word reset-word M: lambda-word reset-word
[ f "lambda" set-word-prop ] [ call-next-method ] bi ; [ call-next-method ] [ f "lambda" set-word-prop ] bi ;
INTERSECTION: lambda-macro macro lambda-word ; INTERSECTION: lambda-macro macro lambda-word ;

View File

@ -24,7 +24,7 @@ M: macro definer drop \ MACRO: \ ; ;
M: macro definition "macro" word-prop ; M: macro definition "macro" word-prop ;
M: macro reset-word M: macro reset-word
[ f "macro" set-word-prop ] [ call-next-method ] bi ; [ call-next-method ] [ f "macro" set-word-prop ] bi ;
: macro-expand ( ... word -- quot ) "macro" word-prop call ; : macro-expand ( ... word -- quot ) "macro" word-prop call ;

View File

@ -48,8 +48,8 @@ M: memoized definer drop \ MEMO: \ ; ;
M: memoized definition "memo-quot" word-prop ; M: memoized definition "memo-quot" word-prop ;
M: memoized reset-word M: memoized reset-word
[ { "memoize" "memo-quot" } reset-props ]
[ call-next-method ] [ call-next-method ]
[ { "memoize" "memo-quot" } reset-props ]
bi ; bi ;
: memoize-quot ( quot effect -- memo-quot ) : memoize-quot ( quot effect -- memo-quot )

View File

@ -1,5 +1,7 @@
USING: math math.parser calendar calendar.format strings words ! Copyright (C) 2008 Slava Pestov.
kernel effects ; ! See http://factorcode.org/license.txt for BSD license.
USING: accessors math math.parser calendar calendar.format
strings words kernel effects ;
IN: present IN: present
GENERIC: present ( object -- string ) GENERIC: present ( object -- string )

View File

@ -1,11 +1,11 @@
IN: tools.profiler.tests IN: tools.profiler.tests
USING: tools.profiler tools.test kernel memory math threads USING: accessors tools.profiler tools.test kernel memory math
alien tools.profiler.private sequences ; threads alien tools.profiler.private sequences ;
[ t ] [ [ t ] [
\ length profile-counter \ length counter>>
10 [ { } length drop ] times 10 [ { } length drop ] times
\ length profile-counter = \ length counter>> =
] unit-test ] unit-test
[ ] [ [ 10 [ gc ] times ] profile ] unit-test [ ] [ [ 10 [ gc ] times ] profile ] unit-test
@ -31,7 +31,7 @@ alien tools.profiler.private sequences ;
foobar foobar
] profile ] profile
[ 1 ] [ \ foobar profile-counter ] unit-test [ 1 ] [ \ foobar counter>> ] unit-test
: fooblah { } [ ] each ; : fooblah { } [ ] each ;
@ -39,6 +39,6 @@ alien tools.profiler.private sequences ;
[ foobaz ] profile [ foobaz ] profile
[ 1 ] [ \ foobaz profile-counter ] unit-test [ 1 ] [ \ foobaz counter>> ] unit-test
[ 2 ] [ \ fooblah profile-counter ] unit-test [ 2 ] [ \ fooblah counter>> ] unit-test

View File

@ -1,6 +1,6 @@
! Copyright (C) 2005, 2006 Daniel Ehrenberg ! Copyright (C) 2005, 2006 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces sequences words io assocs USING: accessors kernel namespaces sequences words io assocs
quotations strings parser lexer arrays xml.data xml.writer debugger quotations strings parser lexer arrays xml.data xml.writer debugger
splitting vectors sequences.deep combinators ; splitting vectors sequences.deep combinators ;
IN: xml.utilities IN: xml.utilities