parent
ce8b624a5a
commit
d58f3cc987
@ -1 +1,2 @@
|
||||
/byteorder-1.1.0.crate
|
||||
/byteorder-1.2.1.crate
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 403638e8d7ca2b0cd24034976c7a164bbd15b4dd Mon Sep 17 00:00:00 2001
|
||||
From: Josh Stone <jistone@redhat.com>
|
||||
Date: Mon, 13 Nov 2017 11:26:47 -0800
|
||||
Subject: [PATCH] Fix prop_ext_[u]int_*::native_endian on BE targets
|
||||
|
||||
The similar `big_endian` tests were using an offset to read from the
|
||||
end of the written `u64`, but the `native_endian` tests were reading
|
||||
directly, just like the `little_endian` tests. That's of course only
|
||||
correct when the target actually is little endian.
|
||||
|
||||
That `big_endian` offset is now sliced directly, instead of cloning into
|
||||
another vector, and then this logic is also used in the `native_endian`
|
||||
test, depending on the current `#[cfg(target_endian)]`.
|
||||
|
||||
Fixes #102.
|
||||
---
|
||||
src/lib.rs | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index b60fe7c..35c0069 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -2865,9 +2865,8 @@ mod stdtests {
|
||||
fn prop(n: $ty_int) -> bool {
|
||||
let mut wtr = vec![];
|
||||
wtr.$write::<BigEndian>(n.clone()).unwrap();
|
||||
- let mut rdr = Vec::new();
|
||||
- rdr.extend(wtr[wtr.len()-$bytes..].iter().map(|&x| x));
|
||||
- let mut rdr = Cursor::new(rdr);
|
||||
+ let offset = wtr.len() - $bytes;
|
||||
+ let mut rdr = Cursor::new(&mut wtr[offset..]);
|
||||
n == rdr.$read::<BigEndian>($bytes).unwrap()
|
||||
}
|
||||
qc_sized(prop as fn($ty_int) -> bool, $max);
|
||||
@@ -2889,7 +2888,12 @@ mod stdtests {
|
||||
fn prop(n: $ty_int) -> bool {
|
||||
let mut wtr = vec![];
|
||||
wtr.$write::<NativeEndian>(n.clone()).unwrap();
|
||||
- let mut rdr = Cursor::new(wtr);
|
||||
+ let offset = if cfg!(target_endian = "big") {
|
||||
+ wtr.len() - $bytes
|
||||
+ } else {
|
||||
+ 0
|
||||
+ };
|
||||
+ let mut rdr = Cursor::new(&mut wtr[offset..]);
|
||||
n == rdr.$read::<NativeEndian>($bytes).unwrap()
|
||||
}
|
||||
qc_sized(prop as fn($ty_int) -> bool, $max);
|
||||
--
|
||||
2.15.0
|
||||
|
@ -0,0 +1,11 @@
|
||||
--- byteorder-1.2.1/Cargo.toml 1970-01-01T01:00:00+01:00
|
||||
+++ byteorder-1.2.1/Cargo.toml 2017-11-30T17:22:26.819390+01:00
|
||||
@@ -29,7 +29,7 @@
|
||||
name = "byteorder"
|
||||
bench = false
|
||||
[dev-dependencies.quickcheck]
|
||||
-version = "0.4"
|
||||
+version = "0.5"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.rand]
|
@ -1 +1 @@
|
||||
SHA512 (byteorder-1.1.0.crate) = 610c77c91fa3c23699d28d78631b87e6d4c56ad9754dabfb640f9ac4a41a2925c1a44c34988654bdcd4b02a3474ddf374d98999f6d53bed68835360d288b9922
|
||||
SHA512 (byteorder-1.2.1.crate) = 3b8822286a3973ef80309f30e169dee5fd87d98a0b4f5a44da7e29c2f14f5ce47a9f109087c84cab09078ad0c3507bb459bac243528bf4d8eae7a958394a4041
|
||||
|
Loading…
Reference in new issue