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.
{ $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 }"
}
} ;
--- /dev/null
+crc me 123
{ $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
}
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 }
! 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
{
} [
"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