lib.rs 1.46 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright 2017 The Australian National University
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

15
extern crate mu;
16 17
extern crate utils;
#[macro_use]
18
extern crate log;
qinsoon's avatar
qinsoon committed
19
extern crate maplit;
20

21 22 23
#[macro_use]
mod ir_macros;

24
mod test_ir;
qinsoon's avatar
qinsoon committed
25
mod test_compiler;
26
mod test_runtime;
27
mod test_api;
qinsoon's avatar
qinsoon committed
28

qinsoon's avatar
qinsoon committed
29 30
mod common {
    use std::fmt;
31 32

    #[allow(dead_code)]
33
    pub fn assert_vector_ordered <T: fmt::Debug> (left: &Vec<T>, right: &Vec<T>) {
qinsoon's avatar
qinsoon committed
34 35
        assert_debug_str(left, right);
    }
36 37

    #[allow(dead_code)]
38 39 40 41 42 43 44 45
    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);
    }
46 47

    #[allow(dead_code)]
qinsoon's avatar
qinsoon committed
48 49
    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
50
    }
51
}