+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: kernel
-USE: math
-USE: stack
-USE: stdio
-USE: test
-USE: words
-
-"Check compiler's auxiliary quotation code." print
-
-: [call] call ; inline
-: [[call]] [call] ; inline
-
-: [nop] [ nop ] call ; word must-compile
-: [[nop]] [ nop ] [call] ; word must-compile
-: [[[nop]]] [ nop ] [[call]] ; word must-compile
-
-[ ] [ ] [ [nop] ] test-word
-[ ] [ ] [ [[nop]] ] test-word
-[ ] [ ] [ [[[nop]]] ] test-word
-
-: ?call t [ call ] [ drop ] ifte ; inline
-: ?nop [ nop ] ?call ; word must-compile
-
-: ??call t [ call ] [ ?call ] ifte ; inline
-: ??nop [ nop ] ??call ; word must-compile
-
-: ???call t [ call ] [ ???call ] ifte ; inline
-: ???nop [ nop ] ???call ; word must-compile
-
-[ ] [ ] [ ?nop ] test-word
-[ ] [ ] [ ??nop ] test-word
-[ ] [ ] [ ???nop ] test-word
-
-: times-test-1 [ nop ] times ; word must-compile
-: times-test-2 [ succ ] times ; word must-compile
-: times-test-3 0 10 [ succ ] times ; word must-compile
-
-[ ] [ 10 ] [ times-test-1 ] test-word
-[ 10 ] [ 0 10 ] [ times-test-2 ] test-word
-[ 10 ] [ ] [ times-test-3 ] test-word
-
-: nested-ifte [ [ 1 ] [ 2 ] ifte ] [ [ 3 ] [ 4 ] ifte ] ifte ; word must-compile
-
-[ 1 ] [ t t ] [ nested-ifte ] test-word
-[ 2 ] [ f t ] [ nested-ifte ] test-word
-[ 3 ] [ t f ] [ nested-ifte ] test-word
-[ 4 ] [ f f ] [ nested-ifte ] test-word
-
-: flow-erasure [ 2 2 + ] [ ] swap >r call r> call ; inline word must-compile
-
-[ 4 ] [ ] [ flow-erasure ] test-word
-
-! This got broken when I changed : ifte ? call ; to primitive
-: twice-nested-ifte
- t [
- t [
-
- ] [
- twice-nested-ifte
- ] ifte
- ] [
-
- ] ifte ; word must-compile
-
-"Auxiliary quotation checks done." print
+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: compiler
-USE: kernel
-USE: lists
-USE: logic
-USE: math
-USE: stack
-USE: stdio
-USE: test
-USE: words
-
-"Checking compiler type coercions." print
-
-: >boolean [ "boolean" ] "java.lang.Boolean" jnew ; word must-compile
-: >byte [ "byte" ] "java.lang.Byte" jnew ; word must-compile
-: >char [ "char" ] "java.lang.Character" jnew ; word must-compile
-: >short [ "short" ] "java.lang.Short" jnew ; word must-compile
-: >int [ "int" ] "java.lang.Integer" jnew ; word must-compile
-: >float [ "float" ] "java.lang.Float" jnew ; word must-compile
-: >long [ "long" ] "java.lang.Long" jnew ; word must-compile
-: >double [ "double" ] "java.lang.Double" jnew ; word must-compile
-
-"Type coercion checks done." print
+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: compiler
-USE: inspector
-USE: kernel
-USE: lists
-USE: logic
-USE: math
-USE: stack
-USE: stdio
-USE: test
-USE: words
-
-"Checking compiler." print
-
-[ 1 2 3 ] [ 4 5 6 ] [ t [ 3drop 1 2 3 ] when ] test-word
-[ 4 5 6 ] [ 4 5 6 ] [ f [ 3drop 1 2 3 ] when ] test-word
-
-[ t ] [ t ] [ [ t ] [ f ] rot [ drop call ] [ nip call ] ifte ] test-word
-[ f ] [ f ] [ [ t ] [ f ] rot [ drop call ] [ nip call ] ifte ] test-word
-[ 4 ] [ 2 ] [ t [ 2 ] [ 3 ] ifte + ] test-word
-[ 5 ] [ 2 ] [ f [ 2 ] [ 3 ] ifte + ] test-word
-
-: stack-frame-test ( x -- x )
- >r t [ r> ] [ r> drop 11 ] ifte ; word must-compile
-
-[ 10 ] [ 10 ] [ stack-frame-test ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ sq ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ mag2 ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ fac ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ fib ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ balance ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ dup [ sq ] when ] ] [ balance>list ] test-word
-
-: null-rec ( -- )
- t [ null-rec ] when ; word must-compile
-
-[ [ 0 0 0 0 ] ] [ [ null-rec ] ] [ balance>list ] test-word
-
-: null-rec ( -- )
- t [ null-rec ] unless ; word must-compile
-
-[ [ 0 0 0 0 ] ] [ [ null-rec ] ] [ balance>list ] test-word
-
-! : null-rec ( -- )
-! t [ drop null-rec ] when* ; word must-compile
-!
-! [ [ 0 0 0 0 ] ] [ [ null-rec ] ] [ balance>list ] test-word
-
-!: null-rec ( -- )
-! t [ t null-rec ] unless* drop ; word must-compile test-null-rec
-
-[ f 1 2 3 ] [ [ [ 2 | 1 ] ] 3 ] [ >r unswons unswons r> ] test-word
-
-[ [ 2 1 0 0 ] ] [ [ >r [ ] [ ] ifte r> ] ] [ balance>list ] test-word
-
-: nested-rec ( -- )
- t [ nested-rec ] when ; word must-compile
-
-: nested-rec-test ( -- )
- 5 nested-rec drop ; word must-compile
-
-[ [ 0 0 0 0 ] ] [ [ nested-rec-test ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ relative>absolute-object-path ] ] [ balance>list ] test-word
-
-! We had a problem with JVM stack overflow...
-
-: null-map [ ] map ; word must-compile
-
-! And a problem with stack normalization after ifte if both
-! datastack and callstack were in use...
-
-: map-test [ dup [ ] when ] map ; word must-compile
-
-[ [ 1 2 3 ] ] [ [ 1 2 3 ] ] [ map-test ] test-word
-
-: nested-test-iter f [ nested-test-iter ] when ;
-: nested-test f nested-test-iter drop ; word must-compile
-
-! Attempts at making setFields() lazy exposed some bugs with
-! recursive compilations.
-
-"car" decompile
-"cdr" decompile
-: nested-test-inline dup cdr swap car ; inline
-: nested-test nested-test-inline ;
-: nested-test-2 nested-test ; word must-compile
-
-! Not all words that we compile calls do are from a
-! FactorClassLoader; eg, primitives.
-
-: calling-primitive-core define ; word must-compile
-
-! Making sure compilation of these never breaks again for
-! various reasons
-"balance" must-compile
-"decompile" must-compile
-
-: 3-recurse ( -- )
- t [ t [ 3-recurse ] when ] [ 3-recurse ] ifte ;
- word must-compile
-
-"All compiler checks passed." print
+++ /dev/null
-IN: scratchpad
-USE: compiler
-USE: lists
-USE: math
-USE: stack
-USE: stdio
-USE: test
-
-"Checking type inference." print
-
-![ [ [ "java.lang.Number" "java.lang.Number" ] [ "java.lang.Number" ] f f ] ]
-![ [ + ] ]
-![ balance>typelist ]
-!test-word
-!
-![ [ [ "factor.Cons" ] [ "java.lang.Object" ] f f ] ]
-![ [ car ] ]
-![ balance>typelist ]
-!test-word
-!
-![ [ [ "factor.Cons" "java.lang.Object" ] f f f ] ]
-![ [ set-car ] ]
-![ balance>typelist ]
-!test-word
-!
-![ [ [ "java.lang.Number" "java.lang.Number" ] [ "java.lang.Number" ] f f ] ]
-![ [ swap + ] ]
-![ balance>typelist ]
-!test-word
-!
-![ [ [ "java.lang.Integer" ] [ "java.lang.Integer" ] f f ] ]
-![ [ >fixnum ] ]
-![ balance>typelist ]
-!test-word
-!
-![ [ [ "java.lang.Number" ] [ "java.lang.Number" "java.lang.Number" ] f f ] ]
-![ [ >rect ] ]
-![ balance>typelist ]
-!test-word
-
-"Type inference checks done." print
+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: compiler
-USE: continuations
-USE: kernel
-USE: lists
-USE: logic
-USE: math
-USE: namespaces
-USE: random
-USE: stack
-USE: stdio
-USE: strings
-USE: test
-USE: words
-
-"Checking dictionary words." print
-
-! OUTPUT INPUT WORD
-[ t ] [ "when" ] [ worddef compound? ] test-word
-[ t ] [ "dup" ] [ worddef shuffle? ] test-word
-[ f ] [ "ifte" ] [ worddef shuffle? ] test-word
-[ f ] [ "dup" ] [ worddef compound? ] test-word
-
-! Test word internalization.
-
-: gensym-test ( -- ? )
- f 10 [ gensym gensym = and ] times ;
-
-[ f ] [ ] [ gensym-test ] test-word
-
-: intern-test ( 1 2 -- ? )
- swap intern swap intern = ;
-
-[ f ] [ "#:a" "#:a" ] [ intern-test ] test-word
-[ t ] [ "#:" "#:" ] [ intern-test ] test-word
-
-: word-parameter-test ( -- ? )
- [ dup * ] dup no-name word-parameter = ;
-
-[ t ] [ ] [ word-parameter-test ] test-word
-
-! At one time we had a bug in FactorShuffleDefinition.toList()
-~<< test-shuffle-1 A r:B -- A r:B >>~
-
-[ [ "A" "r:B" "--" "A" "r:B" ] ]
-[ "test-shuffle-1" ]
-[ word-parameter ]
-test-word
-
-~<< test-shuffle-2 A B -- r:A r:B >>~
-
-[ [ "A" "B" "--" "r:A" "r:B" ] ]
-[ "test-shuffle-2" ]
-[ word-parameter ]
-test-word
-
-~<< test-shuffle-3 A r:B r:C r:D r:E -- A C D E >>~
-
-[ [ "A" "r:B" "r:C" "r:D" "r:E" "--" "A" "C" "D" "E" ] ]
-[ "test-shuffle-3" ]
-[ word-parameter ]
-test-word
-
-[ [ 2 1 0 0 ] ] [ [ = ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ class-of ] ] [ balance>list ] test-word
-
-[ "java.lang.Integer" ] [ 5 ] [ class-of ] test-word
-[ "java.lang.Double" ] [ 5.0 ] [ class-of ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ clone ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ comment? ] ] [ balance>list ] test-word
-
-: doc-test ( -- ) ;
-
-[ t ] [ \ doc-test word-parameter car comment? ] unit-test
-
-[ [ 2 1 0 0 ] ] [ [ is ] ] [ balance>list ] test-word
-[ t ] [ "java.lang.Integer" ] [ 0 100 random-int swap is ] test-word
-[ t ] [ "java.lang.Object" ] [ [ 5 ] swap is ] test-word
-[ f ] [ "java.lang.Object" ] [ f swap is ] test-word
-
-[ [ 5 1 0 0 ] ] [ [ >=< ] ] [ balance>list ] test-word
-
-[ [ 1 0 0 0 ] ] [ [ exit* ] ] [ balance>list ] test-word
-
-[ [ 0 1 0 0 ] ] [ [ millis ] ] [ balance>list ] test-word
-
-[ [ 1 1 0 0 ] ] [ [ system-property ] ] [ balance>list ] test-word
-
-[ t ] [ \ ifte dup worddef word-of-worddef = ] unit-test
+++ /dev/null
-IN: scratchpad
-USE: stdio
-USE: test
-
-"Checking primitive compilation." print
-
-! jvar-get
-"car" must-compile
-
-! jvar-get-static
-"version" must-compile
-
-! jnew
-"cons" must-compile
-"<namespace>" must-compile
-
-! jinvoke with return value
-">str" must-compile
-"is" must-compile
-
-! jinvoke without return value
-"set" must-compile
-
-! jinvoke-static
-">rect" must-compile
-"+" must-compile
-
-"Primitive compilation checks done." print
+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: kernel
-USE: lists
-USE: math
-USE: prettyprint
-USE: stack
-USE: stdio
-USE: test
-USE: words
-
-! Test tail recursive compilation.
-
-"Checking tail call optimization." print
-
-! Make sure we're doing *some* form of tail call optimization.
-! Without it, this will overflow the stack.
-
-: tail-call-0 1000 [ ] times ; word must-compile tail-call-0
-
-: tail-call-1 ( -- )
- t [ ] [ tail-call-1 ] ifte ; word must-compile
-
-[ ] [ ] [ tail-call-1 ] test-word
-
-: tail-call-3 ( x y -- z )
- >r dup succ r> swap 6 = [
- +
- ] [
- swap tail-call-3
- ] ifte ; word must-compile
-
-[ 15 ] [ 10 5 ] [ tail-call-3 ] test-word
-
-: tail-call-4 ( element tree -- ? )
- dup [
- 2dup car = [
- nip
- ] [
- cdr dup cons? [
- tail-call-4
- ] [
- ! don't bomb on dotted pairs
- =
- ] ifte
- ] ifte
- ] [
- 2drop f
- ] ifte ; word must-compile
-
-3 [ 1 2 [ 3 4 ] 5 6 ] tail-call-4 .
-
-"Tail call optimization checks done." print
+++ /dev/null
-IN: scratchpad
-USE: compiler
-USE: lists
-USE: math
-USE: stack
-USE: stdio
-USE: strings
-USE: test
-
-"Checking type coercion." print
-
-[ 32 ] [ " " ] [ >char >number ] test-word
-[ 32 ] [ " " ] [ >char >fixnum ] test-word
-
-"Type coercion checks done." print
+++ /dev/null
-USE: compiler
-USE: lists
-USE: math
-USE: stack
-USE: strings
-USE: test
-
-[ [ 2 1 0 0 ] ] [ [ 2list ] ] [ balance>list ] test-word
-[ [ 3 1 0 0 ] ] [ [ 3list ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ append ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ array>list ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ car ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ cdr ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ cons ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ contains? ] ] [ balance>list ] test-word
-[ [ 2 0 0 0 ] ] [ [ cons@ ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ count ] ] [ balance>list ] do-not-test-word
-[ [ 2 1 0 0 ] ] [ [ nth ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ last* ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ last ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ length ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ list? ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ cons? ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ remove ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ reverse ] ] [ balance>list ] test-word
-[ [ 2 2 0 0 ] ] [ [ [ < ] partition ] ] [ balance>list ] test-word
-[ [ 2 2 0 0 ] ] [ [ [ nip string? ] partition ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ num-sort ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ str-sort ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ swons ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ tree-contains? ] ] [ balance>list ] test-word
-[ [ 1 2 0 0 ] ] [ [ uncons ] ] [ balance>list ] test-word
-[ [ 2 1 0 0 ] ] [ [ unique ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ unit ] ] [ balance>list ] test-word
-[ [ 1 2 0 0 ] ] [ [ unswons ] ] [ balance>list ] test-word
-
-[ [ ] ] [ [ ] ] [ array>list ] test-word
-[ [ 1 2 3 ] ] [ [ 1 2 3 ] ] [ array>list ] test-word
-
--- /dev/null
+IN: scratchpad
+USE: kernel
+USE: namespaces
+USE: test
+USE: stack
+USE: words
+
+<namespace> "test-namespace" set
+
+: test-namespace ( -- )
+ <namespace> dup [ namespace = ] bind ;
+
+[ t ] [ test-namespace ] unit-test
+
+! Object paths should not resolve further up in the namestack.
+
+<namespace> "test-namespace" set
+[ f ]
+[ [ "test-namespace" "test-namespace" ] object-path ]
+unit-test
+
+[ f ]
+[ [ "alalal" "boobobo" "bah" ] object-path ]
+unit-test
+
+[ t ]
+[ namespace [ ] object-path = ]
+unit-test
+
+[ t ]
+[
+ \ test-word
+ global [ [ "vocabularies" "test" "test-word" ] object-path ] bind
+ =
+] unit-test
+
+10 "some-global" set
+[ f ]
+[ <namespace> [ f "some-global" set "some-global" get ] bind ]
+unit-test
+
+[
+ 5 [ "test" "object" "path" ] set-object-path
+ [ 5 ] [ [ "test" "object" "path" ] object-path ] unit-test
+
+ 7 [ "test" "object" "pathe" ] set-object-path
+ [ 7 ] [ [ "test" "object" "pathe" ] object-path ] unit-test
+
+ 9 [ "teste" "object" "pathe" ] set-object-path
+ [ 9 ] [ [ "teste" "object" "pathe" ] object-path ] unit-test
+] with-scope
+++ /dev/null
-IN: scratchpad
-USE: combinators
-USE: compiler
-USE: kernel
-USE: math
-USE: namespaces
-USE: stack
-USE: test
-USE: words
-
-[ [ 1 0 0 0 ] ] [ [ >n ] ] [ balance>list ] test-word
-[ [ 1 1 0 0 ] ] [ [ get ] ] [ balance>list ] test-word
-[ [ 2 0 0 0 ] ] [ [ set ] ] [ balance>list ] test-word
-[ [ 0 1 0 0 ] ] [ [ namestack* ] ] [ balance>list ] test-word
-[ [ 0 1 0 0 ] ] [ [ namestack ] ] [ balance>list ] test-word
-[ [ 1 0 0 0 ] ] [ [ set-namestack* ] ] [ balance>list ] test-word
-[ [ 1 0 0 0 ] ] [ [ set-namestack ] ] [ balance>list ] test-word
-[ [ 0 1 0 0 ] ] [ [ n> ] ] [ balance>list ] test-word
-
-: test-this-2 ( -- )
- interpreter dup [ this = ] bind ;
-
-[ t ] [ test-this-2 ] unit-test
-
-: namespace-compile ( x -- x )
- <namespace> [ "x" set ] extend [ "x" get ] bind ; word must-compile
-
-[ 12 ] [ 12 ] [ namespace-compile ] test-word
-
-! A compiler bug in tailcalls that manifests with the namestack
-
-: namespace-tail-call-bug ( x -- x )
- dup 0 = [
- drop
- ] [
- pred <namespace> [ dup "x" set namespace-tail-call-bug ] bind
- ] ifte ; word must-compile
-
-[ f ] [ ] [ 10 namespace-tail-call-bug "x" get 0 = ] test-word
-
-! I did a n> in extend and forgot the obvious case
-[ t ] [ \ dup dup ] [ [ ] extend = ] test-word
-
-: test-this-1 ( -- )
- <namespace> dup [ this = ] bind ;
-
-[ t ] [ test-this-1 ] unit-test
+++ /dev/null
-IN: scratchpad
-USE: kernel
-USE: namespaces
-USE: test
-USE: stack
-USE: words
-
-<namespace> "test-namespace" set
-
-: test-namespace ( -- )
- <namespace> dup [ namespace = ] bind ;
-
-[ t ] [ test-namespace ] unit-test
-
-! Object paths should not resolve further up in the namestack.
-
-<namespace> "test-namespace" set
-[ f ]
-[ [ "test-namespace" "test-namespace" ] object-path ]
-unit-test
-
-[ f ]
-[ [ "alalal" "boobobo" "bah" ] object-path ]
-unit-test
-
-[ t ]
-[ namespace [ ] object-path = ]
-unit-test
-
-[ t ]
-[
- \ test-word
- global [ [ "vocabularies" "test" "test-word" ] object-path ] bind
- =
-] unit-test
-
-10 "some-global" set
-[ f ]
-[ <namespace> [ f "some-global" set "some-global" get ] bind ]
-unit-test
-
-[
- 5 [ "test" "object" "path" ] set-object-path
- [ 5 ] [ [ "test" "object" "path" ] object-path ] unit-test
-
- 7 [ "test" "object" "pathe" ] set-object-path
- [ 7 ] [ [ "test" "object" "pathe" ] object-path ] unit-test
-
- 9 [ "teste" "object" "pathe" ] set-object-path
- [ 9 ] [ [ "teste" "object" "pathe" ] object-path ] unit-test
-] with-scope
"errors"
"hashtables"
"strings"
- "namespaces/namespaces"
+ "namespaces"
"files"
"format"
"parser"
"httpd/url-encoding"
"httpd/html"
"httpd/httpd"
- ] [
- test
- ] each
-
- native? [
"crashes" test
"sbuf" test
"threads" test
"parsing-word" test
"inference" test
"interpreter" test
-
- cpu "x86" = [
- [
- "hsv"
- "x86-compiler/simple"
- "x86-compiler/stack"
- "x86-compiler/ifte"
- "x86-compiler/generic"
- "x86-compiler/bail-out"
- ] [
- test
- ] each
- ] when
- ] when
-
- java? [
+ ] [
+ test
+ ] each
+
+ cpu "x86" = [
[
- "lists/java"
- "namespaces/java"
- "jvm-compiler/auxiliary"
- "jvm-compiler/compiler"
- "jvm-compiler/compiler-types"
- "jvm-compiler/inference"
- "jvm-compiler/primitives"
- "jvm-compiler/tail"
- "jvm-compiler/types"
- "jvm-compiler/miscellaneous"
+ "hsv"
+ "x86-compiler/simple"
+ "x86-compiler/stack"
+ "x86-compiler/ifte"
+ "x86-compiler/generic"
+ "x86-compiler/bail-out"
] [
test
] each