0.62 ready for release

cvs
Slava Pestov 2004-08-17 01:11:27 +00:00
parent 05a44aa547
commit c03c22d3d9
5 changed files with 154 additions and 3 deletions

View File

@ -9,8 +9,6 @@
- sbuf-hashcode
- vector-hashcode
- listener backspace overzealous
- SIGBUS handler
- handle division by zero
- log-client: fix for native
- multitasking

View File

@ -3,7 +3,7 @@
plugin.factor.jedit.FactorPlugin.activate=defer
plugin.factor.jedit.FactorPlugin.name=Factor
plugin.factor.jedit.FactorPlugin.version=0.61
plugin.factor.jedit.FactorPlugin.version=0.62
plugin.factor.jedit.FactorPlugin.author=Slava Pestov
plugin.factor.jedit.FactorPlugin.docs=/doc/plugin.html

View File

@ -0,0 +1,16 @@
IN: scratchpad
USE: errors
USE: kernel
USE: namespaces
USE: stack
USE: test
[ f ] [ [ ] [ ] catch ] unit-test
[ 5 ] [ [ 5 throw ] [ ] catch ] unit-test
[ t ] [
[ "Hello" throw ] [ drop ] catch
global [ "error" get ] bind
"Hello" =
] unit-test

40
library/test/stack.factor Normal file
View File

@ -0,0 +1,40 @@
IN: scratchpad
USE: compiler
USE: stack
USE: stdio
USE: test
! Test the built-in stack words.
"Checking stack words." print
! OUTPUT INPUT WORD
[ ] [ 1 ] [ drop ] test-word
[ ] [ 1 2 ] [ 2drop ] test-word
[ 1 1 ] [ 1 ] [ dup ] test-word
[ 1 2 1 2 ] [ 1 2 ] [ 2dup ] test-word
[ 1 1 2 ] [ 1 2 ] [ dupd ] test-word
[ 1 2 1 2 3 4 ] [ 1 2 3 4 ] [ 2dupd ] test-word
[ 2 ] [ 1 2 ] [ nip ] test-word
[ 3 4 ] [ 1 2 3 4 ] [ 2nip ] test-word
[ ] [ ] [ nop ] test-word
[ 1 2 1 ] [ 1 2 ] [ over ] test-word
[ 1 2 3 4 1 2 ] [ 1 2 3 4 ] [ 2over ] test-word
[ 1 2 3 1 ] [ 1 2 3 ] [ pick ] test-word
[ 2 3 1 ] [ 1 2 3 ] [ rot ] test-word
[ 3 4 5 6 1 2 ] [ 1 2 3 4 5 6 ] [ 2rot ] test-word
[ 3 1 2 ] [ 1 2 3 ] [ -rot ] test-word
[ 5 6 1 2 3 4 ] [ 1 2 3 4 5 6 ] [ 2-rot ] test-word
[ 2 1 ] [ 1 2 ] [ swap ] test-word
[ 3 4 1 2 ] [ 1 2 3 4 ] [ 2swap ] test-word
[ 2 1 3 ] [ 1 2 3 ] [ swapd ] test-word
[ 3 4 1 2 5 6 ] [ 1 2 3 4 5 6 ] [ 2swapd ] test-word
[ 3 2 1 ] [ 1 2 3 ] [ transp ] test-word
[ 5 6 3 4 1 2 ] [ 1 2 3 4 5 6 ] [ 2transp ] test-word
[ 2 1 2 ] [ 1 2 ] [ tuck ] test-word
[ 3 4 1 2 3 4 ] [ 1 2 3 4 ] [ 2tuck ] test-word
[ ] [ 1 ] [ >r r> drop ] test-word
[ 1 2 ] [ 1 2 ] [ >r >r r> r> ] test-word
"Stack checks passed." print

View File

@ -0,0 +1,97 @@
IN: scratchpad
USE: arithmetic
USE: combinators
USE: kernel
USE: namespaces
USE: strings
USE: test
[ f ] [ "A string." f-or-"" ] unit-test
[ t ] [ "" f-or-"" ] unit-test
[ t ] [ f f-or-"" ] unit-test
[ "abc" ] [ [ "a" "b" "c" ] cat ] unit-test
[ "abc" ] [ "ab" "c" cat2 ] unit-test
[ "abc" ] [ "a" "b" "c" cat3 ] unit-test
[ "abcd" ] [ "a" "b" "c" "d" cat4 ] unit-test
[ "abcde" ] [ "a" "b" "c" "d" "e" cat5 ] unit-test
[ 3 ] [ "hola" "a" index-of ] unit-test
[ -1 ] [ "hola" "x" index-of ] unit-test
[ 0 ] [ "a" "" index-of ] unit-test
[ 0 ] [ "" "" index-of ] unit-test
[ 0 ] [ "hola" "hola" index-of ] unit-test
[ 1 ] [ "hola" "ol" index-of ] unit-test
[ -1 ] [ "hola" "amigo" index-of ] unit-test
[ -1 ] [ "hola" "holaa" index-of ] unit-test
[ "Beginning" ] [ "Beginning and end" 9 str-head ] unit-test
[ f ] [ "I" "team" str-contains? ] unit-test
[ t ] [ "ea" "team" str-contains? ] unit-test
[ f ] [ "actore" "Factor" str-contains? ] unit-test
[ "end" ] [ "Beginning and end" 14 str-tail ] unit-test
[ "Beginning" " and end" ] [ "Beginning and end" 9 str/ ] unit-test
[ "Beginning" "and end" ] [ "Beginning and end" 9 str// ] unit-test
[ "hello" "world" ] [ "hello world" " " split1 ] unit-test
[ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
[ "" "" ] [ "great" "great" split1 ] unit-test
[ "and end" ] [ "Beginning and end" "Beginning " str-head? ] unit-test
[ f ] [ "Beginning and end" "Beginning x" str-head? ] unit-test
[ f ] [ "Beginning and end" "eginning " str-head? ] unit-test
[ "Beginning" ] [ "Beginning and end" " and end" str-tail? ] unit-test
[ f ] [ "Beginning and end" "Beginning x" str-tail? ] unit-test
[ f ] [ "Beginning and end" "eginning " str-tail? ] unit-test
[ [ "This" "is" "a" "split" "sentence" ] ]
[ "This is a split sentence" " " split ]
unit-test
[ [ "OneWord" ] ]
[ "OneWord" " " split ]
unit-test
[ [ "a" "b" "c" "d" "e" "f" ] ]
[ "aXXbXXcXXdXXeXXf" "XX" split ] unit-test
[ 6 ]
[
[ "One" "Two" "Little" "Piggy" "Went" "To" "The" "Market" ]
max-str-length
] unit-test
[ "Hello world" ] [ "Hello world\n" ends-with-newline? ] unit-test
[ f ] [ "Hello world" ends-with-newline? ] unit-test
[ "" ] [ "\n" ends-with-newline? ] unit-test
[ f ] [ "" ends-with-newline? ] unit-test
[ t ] [ CHAR: a letter? ] unit-test
[ f ] [ CHAR: A letter? ] unit-test
[ f ] [ CHAR: a LETTER? ] unit-test
[ t ] [ CHAR: A LETTER? ] unit-test
[ t ] [ CHAR: 0 digit? ] unit-test
[ f ] [ CHAR: x digit? ] unit-test
[ t ] [ "abc" "abd" str-compare 0 < ] unit-test
[ t ] [ "z" "abd" str-compare 0 > ] unit-test
native? [
[ t ] [ "Foo" str>sbuf "Foo" str>sbuf = ] unit-test
[ f ] [ "Foo" str>sbuf "Foob" str>sbuf = ] unit-test
[ f ] [ 34 "Foo" str>sbuf = ] unit-test
[ "Hello" ] [
100 <sbuf> "buf" set
"Hello" "buf" get sbuf-append
"buf" get clone "buf-clone" set
"World" "buf-clone" get sbuf-append
"buf" get sbuf>str
] unit-test
] when