lib.rs 1.48 KB
Newer Older
1
// Copyright 2017 The Australian National University
qinsoon's avatar
qinsoon committed
2
//
3 4 5
// 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
qinsoon's avatar
qinsoon committed
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
qinsoon's avatar
qinsoon committed
8
//
9 10 11 12 13 14
// 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
//#![feature(i128_type)]
16

17
extern crate mu;
18
extern crate mu_utils as utils;
19
#[macro_use]
20
extern crate log;
qinsoon's avatar
qinsoon committed
21
extern crate maplit;
22

23 24 25
#[macro_use]
mod ir_macros;

26
mod test_api;
qinsoon's avatar
qinsoon committed
27
mod test_compiler;
28
mod test_ir;
29
mod test_runtime;
qinsoon's avatar
qinsoon committed
30

qinsoon's avatar
qinsoon committed
31 32
mod common {
    use std::fmt;
33 34

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

    #[allow(dead_code)]
qinsoon's avatar
qinsoon committed
40
    pub fn assert_vector_no_order<T: Ord + fmt::Debug + Clone>(left: &Vec<T>, right: &Vec<T>) {
41 42 43 44
        let mut left_clone = left.clone();
        left_clone.sort();
        let mut right_clone = right.clone();
        right_clone.sort();
qinsoon's avatar
qinsoon committed
45

46 47
        assert_debug_str(left_clone, right_clone);
    }
48 49

    #[allow(dead_code)]
qinsoon's avatar
qinsoon committed
50
    pub fn assert_debug_str<T: fmt::Debug, U: fmt::Debug>(left: T, right: U) {
qinsoon's avatar
qinsoon committed
51
        assert_eq!(format!("{:?}", left), format!("{:?}", right))
qinsoon's avatar
qinsoon committed
52
    }
53
}