Skip to content

Commit

Permalink
test: add test for percent_encode_byte_array
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Nov 29, 2024
1 parent a62ae82 commit 2bc44af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/tracker-client/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ impl InfoHash {
self.0
}
}

#[cfg(test)]
mod tests {
use crate::http::percent_encode_byte_array;

#[test]
fn it_should_encode_a_20_byte_array() {
assert_eq!(
percent_encode_byte_array(&[
0x3b, 0x24, 0x55, 0x04, 0xcf, 0x5f, 0x11, 0xbb, 0xdb, 0xe1, 0x20, 0x1c, 0xea, 0x6a, 0x6b, 0xf4, 0x5a, 0xee, 0x1b,
0xc0,
]),
"%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0"
);
}
}

0 comments on commit 2bc44af

Please sign in to comment.