mirror of
https://github.com/notohh/rustlings.git
synced 2024-12-23 03:38:09 -05:00
add another example
This commit is contained in:
parent
d9946a91d4
commit
39b3e3225a
1 changed files with 10 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue