Skip to content
Permalink
Browse files

bittorrent: fix check-bitfield, add a test.

  • Loading branch information
mrjbq7 committed Jan 29, 2020
1 parent 6aa8f64 commit 2300311641778ae8f48d8e0b89c6bd7eff63ea36
Showing with 7 additions and 2 deletions.
  1. +6 −1 extra/bittorrent/bittorrent-tests.factor
  2. +1 −1 extra/bittorrent/bittorrent.factor
@@ -1,4 +1,9 @@
USING: bittorrent io.sockets tools.test ;
USING: bittorrent sequences io.sockets tools.test ;


{ { t f t t f t f t } } [
8 <iota> [ B{ 0b10110101 } check-bitfield ] map
] unit-test

{
{
@@ -40,7 +40,7 @@ torrent-port [ 6881 ] initialize
'[ _ _ [ set-bit ] [ clear-bit ] if ] change-nth ;

: check-bitfield ( n bitfield -- ? )
[ bitfield-index swap ] dip nth bit? ;
[ bitfield-index swap ] dip nth swap bit? ;


! http

0 comments on commit 2300311

Please sign in to comment.
You can’t perform that action at this time.