impl Step for iu128

Also fix the leb128 tests
This commit is contained in:
Simonas Kazlauskas 2016-08-25 02:16:21 +03:00 committed by est31
parent db2527add3
commit 508fef5dff
2 changed files with 3 additions and 10 deletions

View File

@ -242,6 +242,8 @@ step_impl_signed!(i64);
// assume here that it is less than 64-bits.
#[cfg(not(target_pointer_width = "64"))]
step_impl_no_between!(u64 i64);
#[cfg(not(stage0))]
step_impl_no_between!(u128 i128);
/// An adapter for stepping range iterators by a custom amount.
///

View File

@ -154,22 +154,13 @@ fn test_unsigned_leb128() {
#[test]
fn test_signed_leb128() {
let mut values = Vec::new();
let mut i = -500;
while i < 500 {
values.push(i * 123457i64);
i += 1;
}
let values: Vec<_> = (-500..500).map(|i| i * 0x12345789ABCDEF).collect();
let mut stream = Vec::new();
for &x in &values {
let pos = stream.len();
let bytes_written = write_signed_leb128(&mut stream, pos, x);
assert_eq!(stream.len(), pos + bytes_written);
}
let mut pos = 0;
for &x in &values {
let (value, bytes_read) = read_signed_leb128(&mut stream, pos);