]> gitweb.factorcode.org Git - factor.git/blob - basis/io/mmap/mmap-tests.factor
Specialized array overhaul
[factor.git] / basis / io / mmap / mmap-tests.factor
1 USING: io io.mmap io.files io.files.temp
2 io.directories kernel tools.test continuations sequences
3 io.encodings.ascii accessors math ;
4 IN: io.mmap.tests
5
6 [ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
7 [ ] [ "12345" "mmap-test-file.txt" temp-file ascii set-file-contents ] unit-test
8 [ ] [ "mmap-test-file.txt" temp-file [ "char" <mapped-array> CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
9 [ 5 ] [ "mmap-test-file.txt" temp-file [ "char" <mapped-array> length ] with-mapped-file ] unit-test
10 [ 5 ] [ "mmap-test-file.txt" temp-file [ "char" <mapped-array> length ] with-mapped-file-reader ] unit-test
11 [ "22345" ] [ "mmap-test-file.txt" temp-file ascii file-contents ] unit-test
12 [ "mmap-test-file.txt" temp-file delete-file ] ignore-errors
13
14
15 [ "mmap-empty-file.txt" temp-file delete-file ] ignore-errors
16 [ ] [ "mmap-empty-file.txt" temp-file touch-file ] unit-test
17
18 [
19     "mmap-empty-file.txt" temp-file [
20         drop
21     ] with-mapped-file
22 ] [ bad-mmap-size? ] must-fail-with