lib.rs 1.58 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
//#![feature(concat_idents)]
17

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

24 25 26
#[macro_use]
mod ir_macros;

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

32 33 34
#[cfg(feature = "realtime")]
mod rtmu_benchmarks;

qinsoon's avatar
qinsoon committed
35 36
mod common {
    use std::fmt;
37 38

    #[allow(dead_code)]
qinsoon's avatar
qinsoon committed
39
    pub fn assert_vector_ordered<T: fmt::Debug>(left: &Vec<T>, right: &Vec<T>) {
qinsoon's avatar
qinsoon committed
40 41
        assert_debug_str(left, right);
    }
42 43

    #[allow(dead_code)]
44 45 46 47
    pub fn assert_vector_no_order<T: Ord + fmt::Debug + Clone>(
        left: &Vec<T>,
        right: &Vec<T>
    ) {
48 49 50 51
        let mut left_clone = left.clone();
        left_clone.sort();
        let mut right_clone = right.clone();
        right_clone.sort();
qinsoon's avatar
qinsoon committed
52

53 54
        assert_debug_str(left_clone, right_clone);
    }
55 56

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