]> gitweb.factorcode.org Git - factor.git/blob - basis/io/mmap/mmap-tests.factor
factor: Clean up wrong form of specialized-arrays in using lists.
[factor.git] / basis / io / mmap / mmap-tests.factor
1 USING: alien.c-types alien.data compiler.tree.debugger
2 io.encodings.ascii io.files io.mmap kernel locals math sequences
3 sequences.private specialized-arrays tools.test ;
4
5 SPECIALIZED-ARRAY: uint
6
7 [| path |
8     "12345" path ascii set-file-contents
9     { } [ path [ char <mapped-array> CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
10     { 5 } [ path [ char <mapped-array> length ] with-mapped-file ] unit-test
11     { 5 } [ path [ char <mapped-array> length ] with-mapped-file-reader ] unit-test
12     { "22345" } [ path ascii file-contents ] unit-test
13     { t } [ path uint [ sum ] with-mapped-array integer? ] unit-test
14     { t } [ path uint [ sum ] with-mapped-array-reader integer? ] unit-test
15 ] with-test-file
16
17 [| path |
18     [ path [ drop ] with-mapped-file ] [ bad-mmap-size? ] must-fail-with
19 ] with-test-file
20
21 { t } [
22     [ "test.txt" <mapped-file> void* <c-direct-array> first-unsafe ]
23     { nth-unsafe } inlined?
24 ] unit-test