! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test compression.inflate ;
-IN: compression.inflate.tests
{
B{
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel tools.test compression.zlib classes ;
QUALIFIED-WITH: compression.zlib.ffi ffi
-IN: compression.zlib.tests
-: compress-me ( -- byte-array ) B{ 1 2 3 4 5 } ;
-
-{ t } [ compress-me [ compress uncompress ] keep = ] unit-test
+{ t } [ B{ 1 2 3 4 5 } [ compress uncompress ] keep = ] unit-test
[ ffi:Z_DATA_ERROR zlib-error-message ] [ string>> "data error" = ] must-fail-with
USING: documents documents.private accessors sequences
namespaces tools.test make arrays kernel fry ;
-IN: documents.tests
! Tests
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel namespaces tools.test endian ;
-IN: endian.tests
+USING: endian kernel namespaces tools.test ;
{ t } [ [ endianness get big-endian = ] with-big-endian ] unit-test
{ t } [ [ endianness get little-endian = ] with-little-endian ] unit-test
-USING: accessors arrays assocs english.private help.markup kernel math
-math.parser sequences strings tools.test ;
-IN: english
+USING: arrays assocs english help.markup kernel math sequences
+strings tools.test ;
+FROM: english => a/an ;
{ "record" } [ "records" singularize ] unit-test
{ "record" } [ "record" singularize ] unit-test
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel namespaces prettyprint system tools.test
-environment strings sequences ;
-IN: environment.tests
+USING: environment kernel namespaces prettyprint sequences
+strings system tools.test ;
{ } [ os-envs . ] unit-test
USING: eval tools.test ;
-IN: eval.tests
{ 4 } [ "USE: math 2 2 +" eval( -- result ) ] unit-test
[ "USE: math 2 2 +" eval( -- ) ] must-fail
USING: ui game.input tools.test kernel system threads calendar
combinators.short-circuit ;
-IN: game.input.tests
! os { [ windows? ] [ macosx? ] } 1|| [
! This test only works if a mouse is present. Issue #1844
USING: grouping tools.test kernel sequences arrays
math accessors ;
-IN: grouping.tests
[ { 1 2 3 } 0 group ] must-fail
USING: hash-sets.sequences kernel literals sequences sets
tools.test ;
-IN: hash-sets.sequences.tests
-
{ t } [ 0 4 "asdf" <slice> SHS{ "asdf" } in? ] unit-test
{ SHS{ "asdf" } } [
USING: assocs hashtables.sequences kernel literals sequences
tools.test ;
-IN: hashtables.sequences.tests
-
{ 1000 } [ 0 4 "asdf" <slice> SH{ { "asdf" 1000 } } at ] unit-test
{ 1001 } [
USING: accessors combinators io.directories io.files.temp
io.files.windows io.pathnames kernel math sequences tools.test
windows.kernel32 ;
-IN: io.directories.windows.tests
{ { +read-only+ +archive+ } } [
"read-only.file" temp-file {
USING: io.encodings.iana io.encodings.iana.private
io.encodings.utf8 tools.test assocs namespaces ;
-IN: io.encodings.iana.tests
{ utf8 } [ "UTF-8" name>encoding ] unit-test
{ utf8 } [ "utf8" name>encoding ] unit-test
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
-USING: io.encodings.string io.encodings.iso2022 tools.test
-io.encodings.iso2022.private literals strings byte-arrays ;
-IN: io.encodings.iso2022
+USING: byte-arrays io.encodings.iso2022
+io.encodings.iso2022.private io.encodings.string literals
+strings tools.test ;
{ "hello" } [ "hello" >byte-array iso2022 decode ] unit-test
{ "hello" } [ "hello" iso2022 encode >string ] unit-test
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
-USING: io.encodings.shift-jis tools.test io.encodings.string arrays strings ;
-IN: io.encodings.shift-jis.tests
+USING: arrays io.encodings.shift-jis io.encodings.string strings
+tools.test ;
{ { CHAR: replacement-character } } [ { 141 } shift-jis decode >array ] unit-test
{ "" } [ "" shift-jis decode >string ] unit-test
-USING: accessors arrays concurrency.flags fry io io.encodings.ascii
-io.encodings.utf8 io.servers.private io.sockets kernel namespaces
-sequences sets threads tools.test ;
-IN: io.servers
+USING: accessors arrays concurrency.flags fry io
+io.encodings.ascii io.encodings.utf8 io.servers
+io.servers.private io.sockets kernel namespaces sequences sets
+threads tools.test ;
{ t } [ ascii <threaded-server> listen-on empty? ] unit-test
] unit-test
] unless
-
! Test that we can listen on several ports at once.
-TUPLE: my-threaded-server < threaded-server ;
-
{ } [
- utf8 my-threaded-server new-threaded-server
+ utf8 <threaded-server>
"127.0.0.1" 0 <inet4>
"127.0.0.1" 0 <inet4>
2array >>insecure
USING: accessors destructors kernel io.sockets io.sockets.icmp
sequences tools.test ;
-IN: io.sockets.icmp.tests
-
{ { } } [
"localhost" <icmp> resolve-host
[ [ icmp4? ] [ icmp6? ] bi or ] reject
! See http://factorcode.org/license.txt for BSD license.
USING: environment io.standard-paths io.standard-paths.unix
sequences tools.test ;
-IN: io.standard-paths.unix.tests
{ f } [ "" find-in-path ] unit-test
{ t } [
! See http://factorcode.org/license.txt for BSD license.
USING: io.standard-paths io.standard-paths.windows sequences
tools.test ;
-IN: io.standard-paths.windows.tests
[ t ] [ "cmd.exe" find-in-path "cmd.exe" tail? ] unit-test
-USING: accessors continuations destructors io io.encodings
-io.encodings.ascii io.encodings.binary
-io.encodings.string io.encodings.utf8 io.files io.pipes
-io.streams.byte-array io.streams.duplex io.streams.limited io.streams.string
-kernel namespaces strings tools.test system
-io.encodings.8-bit.latin1 ;
-IN: io.streams.limited.tests
+USING: destructors io io.encodings io.encodings.8-bit.latin1
+io.encodings.ascii io.encodings.binary io.encodings.string
+io.encodings.utf8 io.files io.pipes io.streams.byte-array
+io.streams.duplex io.streams.limited io.streams.string kernel
+namespaces strings tools.test ;
{ } [
"hello world\nhow are you today\nthis is a very long line indeed"
{ f } [ "decoded" get stream-readln ] unit-test
-
{ } [
"abc\ndef\nghi"
ascii encode binary <byte-reader> "data" set
{ "" f } [ "\n" "limited" get stream-read-until [ >string ] dip ] unit-test
-
{ CHAR: a }
[ "a" <string-reader> 1 <limited-stream> stream-read1 ] unit-test
USING: io.streams.string io kernel arrays namespaces make
tools.test ;
-IN: io.streams.string.tests
{ "" } [ "" [ contents ] with-string-reader ] unit-test
USING: destructors io io.encodings.binary io.encodings.utf8
io.files io.streams.byte-array io.streams.string
io.streams.throwing kernel namespaces tools.test ;
-IN: io.streams.throwing.tests
{ "asdf" }
[
USING: lists.lazy.examples lists.lazy lists tools.test ;
-IN: lists.lazy.examples.tests
{ { 1 3 5 7 } } [ 4 odds ltake list>array ] unit-test
{ { 0 1 4 9 16 } } [ first-five-squares ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: destructors io io.encodings.utf8 io.files kernel lists
lists.lazy math sequences tools.test ;
-IN: lists.lazy.tests
{ { 1 2 3 4 } } [
{ 1 2 3 4 } >list list>array
! Copyright (C) 2008 James Cash
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test lists math kernel ;
-IN: lists.tests
{ { 3 4 5 6 7 } } [
{ 1 2 3 4 5 } sequence>list [ 2 + ] lmap list>array
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test math math.bits sequences arrays ;
-IN: math.bits.tests
{ t } [ 0b111111 3 <bits> second ] unit-test
{ { t t t } } [ 0b111111 3 <bits> >array ] unit-test
USING: kernel math math.constants math.functions math.order
tools.test prettyprint prettyprint.config namespaces eval
accessors ;
-IN: math.complex.tests
[ 1 C{ 0 1 } rect> ] must-fail
[ C{ 0 1 } 1 rect> ] must-fail
USING: tools.test math.rectangles prettyprint io.streams.string
kernel accessors ;
-IN: math.rectangles.tests
{ RECT: { 10 10 } { 20 20 } }
[
-IN: math.vectors.tests
USING: math.vectors tools.test kernel specialized-arrays compiler
kernel.private alien.c-types math.functions ;
SPECIALIZED-ARRAY: int
{ 1 } [ { C{ 0 1 } } dup h. ] unit-test
-
{ { 1 2 3 } } [
{ t t t } [ { 1 2 3 } ] [ { 4 5 6 } ] vif
] unit-test
{ t f t } [ { 1 2 3 } ] [ { 4 5 6 } ] vif
] unit-test
-! vclamp
{ { 0 30 100 } } [
{ -10 30 120 } { 0 0 0 } { 100 100 100 } vclamp
] unit-test
USING: nibble-arrays tools.test sequences kernel math ;
-IN: nibble-arrays.tests
[ -1 <nibble-array> ] [ T{ bad-array-length f -1 } = ] must-fail-with
USING: alien kernel opengl.gl.extensions system tools.test ;
-IN: opengl.gl.extensions.tests
{ t } [
gl-function-calling-convention
USING: tools.test math opengl opengl.gl ;
-IN: opengl.tests
{ 2 1 } [ { GL_TEXTURE_2D } [ + ] all-enabled ] must-infer-as
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test opengl.gl opengl.textures opengl.textures.private
-images kernel namespaces accessors sequences literals ;
-IN: opengl.textures.tests
+
+USING: accessors images kernel literals opengl.gl
+opengl.textures opengl.textures.private sequences tools.test ;
{
{
USING: alien.c-types io io.streams.string kernel make namespaces
pack pack.private strings tools.test ;
-IN: pack.tests
{ B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } } [
{ 1 2 3 4 5 }
[ "iii" pack ] must-infer
[ "iii" unpack ] must-infer
-: test-pack ( str -- ba )
- "iii" pack ;
-
-[ test-pack ] must-infer
+[ "iii" pack ] must-infer
{ "c" } [ "1c" expand-pack-format ] unit-test
{ "cccc" } [ "4c" expand-pack-format ] unit-test
USING: random sequences tools.test kernel math math.constants
math.functions sets grouping random.private math.statistics ;
-IN: random.tests
{ 4 } [ 4 random-bytes length ] unit-test
{ 7 } [ 7 random-bytes length ] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel random random.sfmt random.sfmt.private
sequences tools.test ;
-IN: random.sfmt.tests
! Period certified by virtue of seed
{ } [ 5 <sfmt-19937> drop ] unit-test
-IN: search-deques.tests
-USING: search-deques tools.test namespaces
-kernel sequences words deques vocabs dlists ;
+USING: deques dlists kernel namespaces sequences tools.test
+vocabs ;
<hashed-dlist> "h" set
USING: sequences.cords strings tools.test kernel sequences ;
-IN: sequences.cords.tests
{ "hello world" } [ "hello" " world" cord-append dup like ] unit-test
USING: sequences sequences.merged tools.test ;
-IN: sequences.merged.tests
{ 0 { 1 2 } } [ 0 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
{ 0 { 3 4 } } [ 1 T{ merged f { { 1 2 } { 3 4 } } } virtual@ ] unit-test
USING: tools.test sequences.parser unicode kernel accessors ;
-IN: sequences.parser.tests
{ "hello" }
[ "hello" [ take-rest ] parse-sequence ] unit-test
! Copyright (C) 2009 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel make sequences sequences.product tools.test ;
-IN: sequences.product.tests
-
{ { { 0 "a" } { 1 "a" } { 2 "a" } { 0 "b" } { 1 "b" } { 2 "b" } } }
[ { { 0 1 2 } { "a" "b" } } <product-sequence> >array ] unit-test
-: x ( n s -- sss ) <repetition> concat ;
-
{ { "a" "aa" "aaa" "b" "bb" "bbb" } }
-[ { { 1 2 3 } { "a" "b" } } [ first2 x ] product-map ] unit-test
+[ { { 1 2 3 } { "a" "b" } } [ first2 <repetition> concat ] product-map ] unit-test
{
{
! Copyright (C) 2012 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays sequences sequences.windowed tools.test ;
-IN: sequences.windowed.tests
{ { { 1 } { 1 2 } { 1 2 3 } { 2 3 4 } { 3 4 5 } { 4 5 6 } } }
[ { 1 2 3 4 5 6 } 3 <windowed-sequence> [ >array ] map ] unit-test
USING: shuffle tools.test ;
-IN: shuffle.tests
{ 1 2 3 4 } [ 3 4 1 2 2swap ] unit-test
-IN: simple-tokenizer.tests
USING: simple-tokenizer tools.test ;
[ "" tokenize ] must-fail
! Copyright (C) 2014 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel sequences sorting tools.coverage
-tools.coverage.private tools.coverage.testvocab tools.coverage.testvocab.child
-tools.coverage.testvocab.private tools.test vocabs.loader ;
-IN: tools.coverage.tests
+tools.coverage.private tools.coverage.testvocab
+tools.coverage.testvocab.child tools.coverage.testvocab.private
+tools.test vocabs.loader ;
{ "foo.private" } [ "foo" private-vocab-name ] unit-test
{ "foo.private" } [ "foo.private" private-vocab-name ] unit-test
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test tools.files strings kernel ;
-IN: tools.files.tests
{ } [ "" directory. ] unit-test
USING: tools.hexdump kernel sequences tools.test byte-arrays ;
-IN: tools.hexdump.tests
{ t } [ B{ } hexdump "Length: 0, 0h\n" = ] unit-test
{ t } [ "abcdefghijklmnopqrstuvwxyz" >byte-array hexdump "Length: 26, 1ah\n00000000h: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop\n00000010h: 71 72 73 74 75 76 77 78 79 7a qrstuvwxyz\n" = ] unit-test
USING: arrays assocs kernel math memory namespaces parser sequences
tools.memory tools.memory.private tools.test tools.time vm ;
-IN: tools.memory.tests
{ } [ room. ] unit-test
{ } [ heap-stats. ] unit-test
USING: tools.ps tools.test ;
-IN: tools.ps.tests
{ } [ ps. ] unit-test
-IN: tools.time.tests
USING: tools.time tools.test compiler.test ;
{ } [ [ [ ] time ] compile-call ] unit-test
-IN: validators.tests
USING: kernel sequences tools.test validators accessors
namespaces assocs ;
USING: vlists kernel persistent.sequences arrays tools.test
namespaces accessors sequences assocs ;
-IN: vlists.tests
{ { "hi" "there" } }
[ VL{ } "hi" swap ppush "there" swap ppush >array ] unit-test
-IN: vocabs.refresh.tests
USING: vocabs.refresh tools.test continuations namespaces ;
{ } [