Add tests for std::num::Wrapping impls
This commit is contained in:
parent
501aa3ee1d
commit
9b08915a18
@ -17,6 +17,7 @@ use std::default::Default;
|
||||
use std::ffi::{CString, OsString};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::num::Wrapping;
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
use std::ffi::CStr;
|
||||
@ -762,6 +763,14 @@ declare_tests! {
|
||||
Token::Bool(true),
|
||||
],
|
||||
}
|
||||
test_wrapping {
|
||||
Wrapping(1usize) => &[
|
||||
Token::U32(1),
|
||||
],
|
||||
Wrapping(1usize) => &[
|
||||
Token::U64(1),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
declare_tests! {
|
||||
@ -1169,4 +1178,10 @@ declare_error_tests! {
|
||||
],
|
||||
"invalid type: sequence, expected unit struct UnitStruct",
|
||||
}
|
||||
test_wrapping_overflow<Wrapping<u16>> {
|
||||
&[
|
||||
Token::U32(65536),
|
||||
],
|
||||
"invalid value: integer `65536`, expected u16",
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ use std::time::{Duration, UNIX_EPOCH};
|
||||
use std::ffi::CString;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::num::Wrapping;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::str;
|
||||
@ -399,6 +400,11 @@ declare_tests! {
|
||||
Token::Bool(true),
|
||||
],
|
||||
}
|
||||
test_wrapping {
|
||||
Wrapping(1usize) => &[
|
||||
Token::U64(1),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
declare_tests! {
|
||||
|
Loading…
Reference in New Issue
Block a user