Fix serde tests for rand_isaac and rand_xorshift

This commit is contained in:
Vinzent Steinberg 2018-07-20 15:44:15 +02:00
parent a3ac8d3a6a
commit 2a658d9fe4
6 changed files with 25 additions and 11 deletions

View File

@ -20,11 +20,11 @@ appveyor = { repository = "alexcrichton/rand" }
[features]
default = ["std" ] # without "std" rand uses libcore
nightly = ["i128_support", "simd_support"] # enables all features requiring nightly rust
std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"]
std = ["rand_core/std", "rand_isaac/std", "rand_xorshift/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"]
alloc = ["rand_core/alloc"] # enables Vec and Box support (without std)
i128_support = [] # enables i128 and u128 support
simd_support = [] # enables SIMD support
serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs
serde1 = ["serde", "serde_derive", "rand_core/serde1", "rand_isaac/serde1", "rand_xorshift/serde1"] # enables serialization for PRNGs
[workspace]
members = ["rand_core", "rand_isaac", "rand_xorshift"]
@ -32,8 +32,8 @@ members = ["rand_core", "rand_isaac", "rand_xorshift"]
[dependencies]
rand_core = { path = "rand_core", version = "0.2", default-features = false }
# only for deprecations and benches:
rand_isaac = { path = "rand_isaac", version = "0.1", default-features = false }
rand_xorshift = { path = "rand_xorshift", version = "0.1", default-features = false }
rand_isaac = { path = "rand_isaac", version = "0.1" }
rand_xorshift = { path = "rand_xorshift", version = "0.1" }
log = { version = "0.4", optional = true }
serde = { version = "1", optional = true }
serde_derive = { version = "1", optional = true }

View File

@ -18,9 +18,15 @@ travis-ci = { repository = "rust-lang-nursery/rand" }
appveyor = { repository = "alexcrichton/rand" }
[features]
serde1 = ["serde", "serde_derive"] # enables serde for BlockRng wrapper
serde1 = ["serde", "serde_derive", "rand_core/serde1"]
std = []
[dependencies]
rand_core = { path = "../rand_core", version = "0.2", default-features=false }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }
[dev-dependencies]
# This is for testing serde, unfortunately we can't specify feature-gated dev
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
bincode = "1"

View File

@ -18,11 +18,12 @@
#![deny(missing_debug_implementations)]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![no_std]
#![cfg_attr(not(feature="std"), no_std)]
#[cfg(feature="std")] extern crate std as core;
extern crate rand_core;
#[cfg(test)] #[cfg(feature="serde1")] extern crate bincode;
#[cfg(all(feature="serde1", test))] extern crate bincode;
#[cfg(feature="serde1")] extern crate serde;
#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive;

View File

@ -18,9 +18,15 @@ travis-ci = { repository = "rust-lang-nursery/rand" }
appveyor = { repository = "alexcrichton/rand" }
[features]
serde1 = ["serde", "serde_derive"] # enables serde for BlockRng wrapper
serde1 = ["serde", "serde_derive"]
std = []
[dependencies]
rand_core = { path = "../rand_core", version = "0.2", default-features=false }
serde = { version = "1", optional = true }
serde_derive = { version = "^1.0.38", optional = true }
[dev-dependencies]
# This is for testing serde, unfortunately we can't specify feature-gated dev
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
bincode = "1"

View File

@ -18,13 +18,14 @@
#![deny(missing_debug_implementations)]
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
#![no_std]
#![cfg_attr(not(feature="std"), no_std)]
#[cfg(feature="std")] extern crate std as core;
extern crate rand_core;
#[cfg(test)] #[cfg(feature="serde1")] extern crate bincode;
#[cfg(feature="serde1")] extern crate serde;
#[cfg(feature="serde1")] #[macro_use] extern crate serde_derive;
#[cfg(all(feature="serde1", test))] extern crate bincode;
mod xorshift;

View File

@ -237,7 +237,7 @@
#[cfg(feature="std")] extern crate std as core;
#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc;
#[cfg(test)] #[cfg(feature="serde1")] extern crate bincode;
#[cfg(all(feature="serde1", test))] extern crate bincode;
#[cfg(feature="serde1")] extern crate serde;
#[cfg(all(target_arch="wasm32", not(target_os="emscripten"), feature="stdweb"))]