mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 00:34:17 -05:00
feat(structs1): convert structs to use i32 types
This commit is contained in:
parent
2e62505143
commit
19bec50399
2 changed files with 7 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
// structs1.rs
|
// structs1.rs
|
||||||
// Address all the TODOs to make the tests pass!
|
// Address all the TODOs to make the tests pass!
|
||||||
|
// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
@ -21,8 +22,9 @@ mod tests {
|
||||||
// TODO: Instantiate a classic c struct!
|
// TODO: Instantiate a classic c struct!
|
||||||
// let green =
|
// let green =
|
||||||
|
|
||||||
assert_eq!(green.name, "green");
|
assert_eq!(green.red, 0);
|
||||||
assert_eq!(green.hex, "#00FF00");
|
assert_eq!(green.green, 255);
|
||||||
|
assert_eq!(green.blue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -30,8 +32,9 @@ mod tests {
|
||||||
// TODO: Instantiate a tuple struct!
|
// TODO: Instantiate a tuple struct!
|
||||||
// let green =
|
// let green =
|
||||||
|
|
||||||
assert_eq!(green.0, "green");
|
assert_eq!(green.0, 0);
|
||||||
assert_eq!(green.1, "#00FF00");
|
assert_eq!(green.1, 255);
|
||||||
|
assert_eq!(green.2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -357,7 +357,6 @@ Can you figure out how?
|
||||||
|
|
||||||
Another hint: it has to do with the `&` character."""
|
Another hint: it has to do with the `&` character."""
|
||||||
|
|
||||||
|
|
||||||
# STRUCTS
|
# STRUCTS
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
|
|
Loading…
Reference in a new issue