Upgrade dependencies #3

Merged
mehcode merged 1 commits from feature/up into master 2018-10-23 15:07:28 -07:00
2 changed files with 11 additions and 7 deletions
Showing only changes of commit 939621b8c4 - Show all commits

View File

@@ -10,7 +10,8 @@ repository = "https://github.com/acw/simple_asn1"
[dependencies] [dependencies]
chrono = "^0.4.0" chrono = "^0.4.0"
num = "^0.1.40" num = "^0.2.0"
[dev-dependencies] [dev-dependencies]
quickcheck = "^0.4.1" quickcheck = "^0.7.1"
rand = "0.5.5"

View File

@@ -31,6 +31,8 @@ extern crate num;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
extern crate quickcheck; extern crate quickcheck;
#[cfg(test)]
extern crate rand;
use chrono::{DateTime,TimeZone,Utc}; use chrono::{DateTime,TimeZone,Utc};
use num::{BigInt,BigUint,FromPrimitive,One,ToPrimitive,Zero}; use num::{BigInt,BigUint,FromPrimitive,One,ToPrimitive,Zero};
@@ -905,6 +907,7 @@ mod tests {
use quickcheck::{Arbitrary,Gen}; use quickcheck::{Arbitrary,Gen};
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use rand::{Rng, distributions::Standard};
use super::*; use super::*;
impl Arbitrary for ASN1Class { impl Arbitrary for ASN1Class {
@@ -993,14 +996,14 @@ mod tests {
let nbits = if modbits > maxbits let nbits = if modbits > maxbits
{ maxbits } { maxbits }
else { maxbits - modbits }; else { maxbits - modbits };
let bytes = g.gen_iter::<u8>().take(size).collect(); let bytes = g.sample_iter::<u8, _>(&Standard).take(size).collect();
ASN1Block::BitString(class, 0, nbits, bytes) ASN1Block::BitString(class, 0, nbits, bytes)
} }
fn arb_octstr<G: Gen>(g: &mut G, _d: usize) -> ASN1Block { fn arb_octstr<G: Gen>(g: &mut G, _d: usize) -> ASN1Block {
let class = ASN1Class::arbitrary(g); let class = ASN1Class::arbitrary(g);
let size = g.gen::<u16>() as usize % 16; let size = g.gen::<u16>() as usize % 16;
let bytes = g.gen_iter::<u8>().take(size).collect(); let bytes = g.sample_iter::<u8, _>(&Standard).take(size).collect();
ASN1Block::OctetString(class, 0, bytes) ASN1Block::OctetString(class, 0, bytes)
} }
@@ -1154,7 +1157,7 @@ mod tests {
let class = ASN1Class::arbitrary(g); let class = ASN1Class::arbitrary(g);
let tag = RandomUint::arbitrary(g); let tag = RandomUint::arbitrary(g);
let size = g.gen_range::<usize>(0, 128); let size = g.gen_range::<usize>(0, 128);
let items = g.gen_iter::<u8>().take(size).collect(); let items = g.sample_iter::<u8, _>(&Standard).take(size).collect();
ASN1Block::Unknown(class, 0, tag.x, items) ASN1Block::Unknown(class, 0, tag.x, items)
} }