add using and unit tests for mmap
parent
36775661a9
commit
7d39e51d9a
|
@ -47,7 +47,7 @@ HELP: with-mapped-array
|
|||
{ $description "Memory-maps a file for reading and writing as a mapped-array of the given c-type. The mapped file is disposed of when the quotation returns, or if an error is thrown." }
|
||||
{ $examples
|
||||
{ $unchecked-example
|
||||
"USING: io.mmap prettyprint specialized-arrays ;"
|
||||
"USING: alien.c-types io.mmap prettyprint specialized-arrays ;"
|
||||
"SPECIALIZED-ARRAY: uint"
|
||||
""""resource:license.txt" uint [
|
||||
[ . ] each
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: io io.mmap io.files io.files.temp io.directories kernel
|
||||
tools.test continuations sequences io.encodings.ascii accessors
|
||||
math compiler.tree.debugger alien.data alien.c-types
|
||||
sequences.private ;
|
||||
USING: alien.c-types alien.data compiler.tree.debugger
|
||||
continuations io.directories io.encodings.ascii io.files
|
||||
io.files.temp io.mmap kernel math sequences sequences.private
|
||||
specialized-arrays specialized-arrays.instances.uint tools.test ;
|
||||
IN: io.mmap.tests
|
||||
|
||||
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
||||
|
@ -10,6 +10,19 @@ IN: io.mmap.tests
|
|||
[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file ] unit-test
|
||||
[ 5 ] [ "mmap-test-file.txt" temp-file [ char <mapped-array> length ] with-mapped-file-reader ] unit-test
|
||||
[ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
|
||||
|
||||
SPECIALIZED-ARRAY: uint
|
||||
|
||||
[ t ] [
|
||||
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array
|
||||
integer?
|
||||
] unit-test
|
||||
|
||||
[ t ] [
|
||||
"mmap-test-file.txt" temp-file uint [ sum ] with-mapped-array-reader
|
||||
integer?
|
||||
] unit-test
|
||||
|
||||
[ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue