mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-11-29 22:47:43 +02:00
Require a main function in all exercises
This commit is contained in:
@@ -24,6 +24,10 @@ fn fruit_basket() -> HashMap<String, u32> {
|
||||
basket
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -41,6 +41,10 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -79,7 +83,7 @@ mod tests {
|
||||
let count = basket.values().sum::<u32>();
|
||||
assert!(count > 11);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn all_fruit_types_in_basket() {
|
||||
let mut basket = get_fruit_basket();
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// Example: England,France,4,2 (England scored 4 goals, France 2).
|
||||
//
|
||||
// You have to build a scores table containing the name of the team, the total
|
||||
// number of goals the team scored, and the total number of goals the team
|
||||
// conceded. One approach to build the scores table is to use a Hashmap.
|
||||
// The solution is partially written to use a Hashmap,
|
||||
// number of goals the team scored, and the total number of goals the team
|
||||
// conceded. One approach to build the scores table is to use a Hashmap.
|
||||
// The solution is partially written to use a Hashmap,
|
||||
// complete it to pass the test.
|
||||
//
|
||||
// Make me pass the tests!
|
||||
@@ -42,6 +42,10 @@ fn build_scores_table(results: String) -> HashMap<String, Team> {
|
||||
scores
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// You can optionally experiment here.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user