mirror of
https://github.com/rust-lang/rustlings
synced 2024-11-18 09:25:36 +00:00
add another example
This commit is contained in:
parent
d9946a91d4
commit
39b3e3225a
@ -1,4 +1,3 @@
|
|||||||
#[allow(dead_code)]
|
|
||||||
fn guess_this () -> i32 {
|
fn guess_this () -> i32 {
|
||||||
let one = 5;
|
let one = 5;
|
||||||
let two = 7;
|
let two = 7;
|
||||||
@ -7,14 +6,24 @@ fn guess_this () -> i32 {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn simple () -> &'static str {
|
||||||
|
let hello = "Hello World!";
|
||||||
|
return hello;
|
||||||
|
}
|
||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
pub fn test_simple () {
|
||||||
|
verify!("Hello World!", simple(), "Simple example");
|
||||||
|
}
|
||||||
|
|
||||||
pub fn test_complicated () {
|
pub fn test_complicated () {
|
||||||
verify!(1, guess_this(), "Complicated example");
|
verify!(1, guess_this(), "Complicated example");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exec () {
|
pub fn exec () {
|
||||||
|
tests::test_simple();
|
||||||
tests::test_complicated();
|
tests::test_complicated();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user