2018-05-16 08:30:30 -05:00
|
|
|
fn guess_this() -> i32 {
|
2018-05-14 11:41:58 -05:00
|
|
|
let one = 5;
|
|
|
|
let two = 7;
|
|
|
|
let three = 3;
|
|
|
|
let result = (one + two) / three;
|
|
|
|
return result;
|
2018-05-06 10:27:03 -05:00
|
|
|
}
|
|
|
|
|
2018-05-16 08:30:30 -05:00
|
|
|
fn simple() -> &'static str {
|
2018-05-16 08:27:52 -05:00
|
|
|
let hello = "Hello World!";
|
|
|
|
return hello;
|
|
|
|
}
|
|
|
|
|
2018-05-06 10:27:03 -05:00
|
|
|
mod tests {
|
2018-05-14 11:41:58 -05:00
|
|
|
use super::*;
|
2018-05-06 10:27:03 -05:00
|
|
|
|
2018-05-16 08:30:30 -05:00
|
|
|
pub fn test_simple() {
|
2018-05-16 08:27:52 -05:00
|
|
|
verify!("Hello World!", simple(), "Simple example");
|
|
|
|
}
|
|
|
|
|
2018-05-16 08:30:30 -05:00
|
|
|
pub fn test_complicated() {
|
2018-05-16 08:23:14 -05:00
|
|
|
verify!(1, guess_this(), "Complicated example");
|
2018-05-06 10:27:03 -05:00
|
|
|
}
|
|
|
|
}
|
2018-05-14 11:41:58 -05:00
|
|
|
|
2018-05-16 08:30:30 -05:00
|
|
|
pub fn exec() {
|
2018-05-16 08:27:52 -05:00
|
|
|
tests::test_simple();
|
2018-05-14 11:41:58 -05:00
|
|
|
tests::test_complicated();
|
|
|
|
}
|