lib.rs 680 Bytes
Newer Older
1
mod test_ir;
qinsoon's avatar
qinsoon committed
2 3
mod test_compiler;

qinsoon's avatar
qinsoon committed
4 5 6 7
#[macro_use]
mod common {
    use std::fmt;
    
8
    pub fn assert_vector_ordered <T: fmt::Debug> (left: &Vec<T>, right: &Vec<T>) {
qinsoon's avatar
qinsoon committed
9 10 11
        assert_debug_str(left, right);
    }
    
12 13 14 15 16 17 18 19 20
    pub fn assert_vector_no_order <T: Ord + fmt::Debug + Clone> (left: &Vec<T>, right: &Vec<T>) {
        let mut left_clone = left.clone();
        left_clone.sort();
        let mut right_clone = right.clone();
        right_clone.sort();
        
        assert_debug_str(left_clone, right_clone);
    }
    
qinsoon's avatar
qinsoon committed
21 22
    pub fn assert_debug_str<T: fmt::Debug, U: fmt::Debug> (left: T, right: U) {
        assert_eq!(format!("{:?}", left), format!("{:?}", right))
qinsoon's avatar
qinsoon committed
23 24
    }
}