add test case and cleanup
This commit is contained in:
parent
4a27c1369a
commit
e88612d617
|
@ -75,7 +75,6 @@ struct SmallVec<T> {
|
||||||
|
|
||||||
impl<T: Default + Copy> SmallVec<T> {
|
impl<T: Default + Copy> SmallVec<T> {
|
||||||
pub fn new() -> SmallVec<T> {
|
pub fn new() -> SmallVec<T> {
|
||||||
use std::default::Default;
|
|
||||||
SmallVec {
|
SmallVec {
|
||||||
len: 0,
|
len: 0,
|
||||||
stack: [T::default(); 100],
|
stack: [T::default(); 100],
|
||||||
|
@ -266,6 +265,14 @@ mod tests {
|
||||||
assert_eq!(&encode_slice(&[0, 13, 36][..]), "1211");
|
assert_eq!(&encode_slice(&[0, 13, 36][..]), "1211");
|
||||||
assert_eq!(&encode_slice(&[0, 0, 0, 0, 13, 36][..]), "1111211");
|
assert_eq!(&encode_slice(&[0, 0, 0, 0, 13, 36][..]), "1111211");
|
||||||
|
|
||||||
|
// Long input (>100 bytes => has to use heap)
|
||||||
|
let res = encode_slice(&"BitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBit\
|
||||||
|
coinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoinBitcoin".as_bytes());
|
||||||
|
let exp = "ZqC5ZdfpZRi7fjA8hbhX5pEE96MdH9hEaC1YouxscPtbJF16qVWksHWR4wwvx7MotFcs2ChbJqK8KJ9X\
|
||||||
|
wZznwWn1JFDhhTmGo9v6GjAVikzCsBWZehu7bm22xL8b5zBR5AsBygYRwbFJsNwNkjpyFuDKwmsUTKvkULCvucPJrN5\
|
||||||
|
QUdxpGakhqkZFL7RU4yT";
|
||||||
|
assert_eq!(&res, exp);
|
||||||
|
|
||||||
// Addresses
|
// Addresses
|
||||||
let addr = hex_decode("00f8917303bfa8ef24f292e8fa1419b20460ba064d").unwrap();
|
let addr = hex_decode("00f8917303bfa8ef24f292e8fa1419b20460ba064d").unwrap();
|
||||||
assert_eq!(&check_encode_slice(&addr[..]), "1PfJpZsjreyVrqeoAfabrRwwjQyoSQMmHH");
|
assert_eq!(&check_encode_slice(&addr[..]), "1PfJpZsjreyVrqeoAfabrRwwjQyoSQMmHH");
|
||||||
|
|
Loading…
Reference in New Issue