]> gitweb.factorcode.org Git - factor.git/blobdiff - core/io/streams/byte-array/byte-array-tests.factor
Specialized arrays, structs and other objects responding to the >c-ptr / byte-length...
[factor.git] / core / io / streams / byte-array / byte-array-tests.factor
index 96b122549d840ce9a8f926742f4a589a581a26a0..dc95d454fa137c5196b3cbbb47831461a1da54a7 100644 (file)
@@ -1,5 +1,8 @@
 USING: tools.test io.streams.byte-array io.encodings.binary
-io.encodings.utf8 io kernel arrays strings namespaces math ;
+io.encodings.utf8 io kernel arrays strings namespaces math
+specialized-arrays alien.c-types ;
+SPECIALIZED-ARRAY: int
+IN: io.streams.byte-array.tests
 
 [ B{ } ] [ B{ } binary [ contents ] with-byte-reader ] unit-test
 [ B{ 1 2 3 } ] [ binary [ B{ 1 2 3 } write ] with-byte-writer ] unit-test
@@ -37,3 +40,9 @@ io.encodings.utf8 io kernel arrays strings namespaces math ;
 [ B{ 123 } ] [
     binary [ 123 >bignum write1 ] with-byte-writer
 ] unit-test
+
+! Writing specialized arrays to byte writers
+[ int-array{ 1 2 3 } ] [
+    binary [ int-array{ 1 2 3 } write ] with-byte-writer
+    byte-array>int-array
+] unit-test