]> gitweb.factorcode.org Git - factor.git/commitdiff
tests: Don't depend on license.txt not changing.
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 23 Mar 2019 17:57:26 +0000 (12:57 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 23 Mar 2019 18:00:52 +0000 (13:00 -0500)
It's probably bad to have the year in the license file, but it's worse to depend on
the license never changing.

Add a dummy file to crc32, and for multi checksums, the file we were checksumming is
not really integral to the test since it's read into a buffer first.

core/checksums/checksums-docs.factor
core/checksums/crc32/crc-me.txt [new file with mode: 0644]
extra/checksums/multi/multi-docs.factor
extra/checksums/multi/multi-tests.factor

index 9b2ae6d0529df822fd26c1d63b12c6d27c8f89be..0cd52997a6b223e8b08b859c2898608afb06c01c 100644 (file)
@@ -40,8 +40,8 @@ HELP: checksum-file
 { $examples
     { $example
         "USING: checksums checksums.crc32 prettyprint ;"
-        "\"resource:LICENSE.txt\" crc32 checksum-file ."
-        "B{ 125 29 106 28 }"
+        "\"resource:core/checksums/crc32/crc-me.txt\" crc32 checksum-file ."
+        "B{ 196 202 117 155 }"
     }
 } ;
 
diff --git a/core/checksums/crc32/crc-me.txt b/core/checksums/crc32/crc-me.txt
new file mode 100644 (file)
index 0000000..3a88cf1
--- /dev/null
@@ -0,0 +1 @@
+crc me 123
index c029e813a8b9efe9a3126c3d77108d9a371093bf..d0ee53ec5746bcca782c0bb3587d20893f709645 100644 (file)
@@ -16,7 +16,7 @@ $nl
     { $example "USING: byte-arrays checksums checksums.md5 "
     " checksums.multi checksums.sha ;"
     "\"test\" >byte-array { md5 sha1 } <multi-checksum> checksum-bytes ."
-    "{
+"{
     B{
         9 143 107 205 70 33 211 115 202 222 78 131 38 39 180 246
     }
@@ -24,26 +24,10 @@ $nl
         169 74 143 229 204 177 155 166 28 76 8 115 211 145 233
         135 152 47 187 211
     }
-}" }
-    $nl
-    { $example "USING: checksums checksums.common checksums.md5 "
-    "checksums.multi checksums.sha io io.encodings.binary namespaces ;"
-    "\"resource:LICENSE.txt\" binary ["
-    "    input-stream get { md5 sha1 } <multi-checksum> checksum-stream"
-    "] with-file-reader ."
-    "{
-    B{
-        220 158 207 218 50 163 198 36 234 90 122 65 197 14 224
-        16
-    }
-    B{
-        132 132 148 224 101 202 198 114 38 53 127 18 70 170 108
-        53 25 255 174 207
+}"
     }
-}" }
 } ;
 
-
 HELP: <multi-checksum>
 { $values
     { "checksums" sequence }
index 0a9d2fa75582c2b7336363893b3cc56be8618771..c3be4be5beac43b85888e4653415d90fa20d5a94 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2018 Alexander Ilin.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: byte-arrays checksums checksums.md5 checksums.multi
-checksums.sha io io.encodings.binary io.files namespaces tools.test ;
+checksums.sha tools.test ;
 IN: checksums.multi.tests
 
 {
@@ -17,17 +17,3 @@ IN: checksums.multi.tests
 } [
     "test" >byte-array { md5 sha1 } <multi-checksum> checksum-bytes
 ] unit-test
-
-{
-    {
-        B{ 155 181 180 45 142 211 121 3 86 11 19 254 46 110 208 53 }
-        B{
-            185 16 47 6 163 92 254 132 223 97 1 55 165 73 57 87 243
-            209 7 104
-        }
-    }
-} [
-    "resource:LICENSE.txt" binary [
-        input-stream get { md5 sha1 } <multi-checksum> checksum-stream
-    ] with-file-reader
-] unit-test