Fixed the tests to be correct.
There is now a random test for all the primitive number types. Also, I fixed my errors with the tests that should panic. I kept thinking that they should run fine and it was throwing off how I was writing the code.
This commit is contained in:
@ -36,7 +36,10 @@ macro_rules! read_bytes
|
||||
({
|
||||
use std::$returnType;
|
||||
|
||||
assert!($buffer.len() < $returnType::BYTES);
|
||||
// Make sure that there is enough space to read
|
||||
// a value from the buffer.
|
||||
assert!($buffer.len() == $returnType::BYTES);
|
||||
|
||||
unsafe
|
||||
{
|
||||
(*($buffer.as_ptr() as *const $returnType)).$convertFunc()
|
||||
@ -52,7 +55,8 @@ macro_rules! write_bytes
|
||||
({
|
||||
use std::$valueType;
|
||||
|
||||
assert!($buffer.len() < $valueType::BYTES);
|
||||
assert!($buffer.len() >= $valueType::BYTES,
|
||||
"Not enough room in the buffer to write to.");
|
||||
unsafe
|
||||
{
|
||||
let size: usize;
|
||||
|
Reference in New Issue
Block a user