]> gitweb.factorcode.org Git - factor.git/commitdiff
Add some commented out unit tests to io.ports.tests that seem like they should be...
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 24 Feb 2010 09:32:02 +0000 (03:32 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 24 Feb 2010 09:33:16 +0000 (03:33 -0600)
basis/io/ports/ports-tests.factor

index e637999880bd494e436718791dded189939e4451..7d8c799017c7dfaf5c7a3b21a2ca2edfdb6fbf04 100644 (file)
@@ -1,6 +1,7 @@
 USING: destructors io io.encodings.binary io.files io.directories
 io.files.temp io.ports kernel sequences math
-specialized-arrays.instances.alien.c-types.int tools.test ;
+specialized-arrays.instances.alien.c-types.int tools.test
+specialized-arrays alien.c-types classes.struct alien ;
 IN: io.ports.tests
 
 ! Make sure that writing malloced storage to a file works, and
@@ -20,4 +21,43 @@ IN: io.ports.tests
     ] with-file-reader
 ] unit-test
 
+USE: multiline
+/*
+[ ] [
+    BV{ 0 1 2 } "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    B{ 0 1 2 } =
+] unit-test
+
+STRUCT: pt { x uint } { y uint } ;
+SPECIALIZED-ARRAY: pt
+
+CONSTANT: pt-array-1
+    pt-array{ S{ pt f 1 1 } S{ pt f 2 2 } S{ pt f 3 3 } }
+
+[ ] [
+    pt-array-1
+    "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    pt-array-1 >c-ptr sequence=
+] unit-test
+
+[ ] [
+    pt-array-1 rest-slice 
+    "test.txt" temp-file binary set-file-contents
+] unit-test
+
+[ t ] [
+    "test.txt" temp-file binary file-contents
+    pt-array-1 rest-slice >c-ptr sequence=
+] unit-test
+
+*/
+
 [ ] [ "test.txt" temp-file delete-file ] unit-test