Fix tests for upstream changes
This commit is contained in:
parent
7bab60ddbe
commit
656d64916a
|
|
@ -107,7 +107,7 @@ mod tests {
|
||||||
use serialize::hex::{FromHex, ToHex};
|
use serialize::hex::{FromHex, ToHex};
|
||||||
|
|
||||||
struct HashTest {
|
struct HashTest {
|
||||||
input: ~[u8],
|
input: Vec<u8>,
|
||||||
expected_output: ~str
|
expected_output: ~str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash_test(hashtype: super::HashType, hashtest: &HashTest) {
|
fn hash_test(hashtype: super::HashType, hashtest: &HashTest) {
|
||||||
let calced_raw = super::hash(hashtype, hashtest.input);
|
let calced_raw = super::hash(hashtype, hashtest.input.as_slice());
|
||||||
|
|
||||||
let calced = calced_raw.as_slice().to_hex();
|
let calced = calced_raw.as_slice().to_hex();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,10 +225,10 @@ mod tests {
|
||||||
use serialize::hex::ToHex;
|
use serialize::hex::ToHex;
|
||||||
|
|
||||||
let cipher = super::Crypter::new(ciphertype);
|
let cipher = super::Crypter::new(ciphertype);
|
||||||
cipher.init(super::Encrypt, key.from_hex().unwrap(), iv.from_hex().unwrap());
|
cipher.init(super::Encrypt, key.from_hex().unwrap().as_slice(), iv.from_hex().unwrap().as_slice());
|
||||||
|
|
||||||
let expected = Vec::from_slice(ct.from_hex().unwrap());
|
let expected = Vec::from_slice(ct.from_hex().unwrap().as_slice());
|
||||||
let computed = cipher.update(pt.from_hex().unwrap()).append(cipher.final().as_slice());
|
let computed = cipher.update(pt.from_hex().unwrap().as_slice()).append(cipher.final().as_slice());
|
||||||
|
|
||||||
if computed != expected {
|
if computed != expected {
|
||||||
println!("Computed: {}", computed.as_slice().to_hex());
|
println!("Computed: {}", computed.as_slice().to_hex());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue