1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-16 10:51:42 +02:00

add another example

This commit is contained in:
olivia 2018-05-16 15:27:52 +02:00
parent d9946a91d4
commit 39b3e3225a

View File

@ -1,4 +1,3 @@
#[allow(dead_code)]
fn guess_this () -> i32 {
let one = 5;
let two = 7;
@ -7,14 +6,24 @@ fn guess_this () -> i32 {
return result;
}
fn simple () -> &'static str {
let hello = "Hello World!";
return hello;
}
mod tests {
use super::*;
pub fn test_simple () {
verify!("Hello World!", simple(), "Simple example");
}
pub fn test_complicated () {
verify!(1, guess_this(), "Complicated example");
}
}
pub fn exec () {
tests::test_simple();
tests::test_complicated();
}