]> gitweb.factorcode.org Git - factor.git/blob - basis/checksums/internet/internet-tests.factor
11334905b0ce935df3c99a790ae74ac9da3e1883
[factor.git] / basis / checksums / internet / internet-tests.factor
1 ! Copyright (C) 2010 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3 USING: checksums checksums.internet tools.test ;
4 IN: checksums.internet.tests
5
6 { B{ 255 255 } } [ { } internet checksum-bytes ] unit-test
7 { B{ 254 255 } } [ { 1 } internet checksum-bytes ] unit-test
8 { B{ 254 253 } } [ { 1 2 } internet checksum-bytes ] unit-test
9 { B{ 251 253 } } [ { 1 2 3 } internet checksum-bytes ] unit-test
10
11 : test-data ( -- bytes )
12     B{
13         0x00 0x01
14         0xf2 0x03
15         0xf4 0xf5
16         0xf6 0xf7
17     } ;
18
19 { B{ 34 13 } } [ test-data internet checksum-bytes ] unit-test