Upgraded to latest sigils release.

This added the ability to more easily print Vectors and Quaternions.

This also fixes some style issues.

Missing documents will now cause warnings when building.
This commit is contained in:
Jason Travis Smith
2016-01-07 17:49:21 -05:00
parent 1374ff5e4a
commit 307118412b
7 changed files with 43 additions and 40 deletions

View File

@ -44,24 +44,24 @@ macro_rules! create_thread
///
macro_rules! full_check_impl
{
($T: ident, $read_func: ident, $write_func: ident, $numBytes: expr) =>
($varType: ident, $read_func: ident, $write_func: ident, $numBytes: expr) =>
{
{
use std::$T;
use std::$varType;
use rand::ThreadRng;
use rand::distributions::{IndependentSample, Range};
use alchemy::{Converter, BigEndian, LittleEndian};
let range: Range<$T>;
let range: Range<$varType>;
let mut rng: ThreadRng;
rng = rand::thread_rng();
range = Range::new($T::MIN, $T::MAX);
range = Range::new($varType::MIN, $varType::MAX);
for _ in 0..EXHAUSTIVE_RUNS
{
let val: $T;
let final_big_val: $T;
let final_little_val: $T;
let val: $varType;
let final_big_val: $varType;
let final_little_val: $varType;
let mut buffer: [u8; $numBytes];
buffer = [0u8; $numBytes];
@ -90,20 +90,21 @@ macro_rules! full_check_impl
///
macro_rules! full_check
{
($func_name: ident, $T: ident, $read_func: ident, $write_func: ident) =>
($func_name: ident, $varType: ident, $read_func: ident,
$write_func: ident) =>
{
fn $func_name() -> bool
{
full_check_impl!($T, $read_func, $write_func, $T::BYTES)
full_check_impl!($varType, $read_func, $write_func, $varType::BYTES)
}
};
($func_name: ident, $T: ident,
($func_name: ident, $varType: ident,
$read_func: ident, $write_func: ident, $numBytes: expr) =>
{
fn $func_name() -> bool
{
full_check_impl!($T, $read_func, $write_func, $numBytes)
full_check_impl!($varType, $read_func, $write_func, $numBytes)
}
};
}
@ -111,7 +112,7 @@ macro_rules! full_check
/// This should only be called by the macro below.
macro_rules! overflow_impl
{
($numBytes: expr, $T: ident,
($numBytes: expr, $varType: ident,
$read_func: ident, $write_func: ident) =>
{
use alchemy::{Converter, BigEndian, LittleEndian};
@ -146,7 +147,7 @@ macro_rules! overflow_impl
let mut buffer: [u8; $numBytes - 1];
buffer = [0u8; $numBytes - 1];
BigEndian::$write_func(&mut buffer, $T::zero());
BigEndian::$write_func(&mut buffer, $varType::zero());
}
#[test]
@ -156,7 +157,7 @@ macro_rules! overflow_impl
let mut buffer: [u8; $numBytes - 1];
buffer = [0u8; $numBytes - 1];
LittleEndian::$write_func(&mut buffer, $T::zero());
LittleEndian::$write_func(&mut buffer, $varType::zero());
}
};
}
@ -164,14 +165,14 @@ macro_rules! overflow_impl
/// This macro tries to test for buffer overflow happening.
macro_rules! test_buffer_overflow
{
($mod_name: ident, $T: ident,
($mod_name: ident, $varType: ident,
$read_func: ident, $write_func: ident, $numBytes: ident) =>
{
mod $mod_name
{
use alchemy::$numBytes;
overflow_impl!($numBytes, $T, $read_func, $write_func);
overflow_impl!($numBytes, $varType, $read_func, $write_func);
}
}
}