summaryrefslogtreecommitdiff
path: root/exercises/conversions
diff options
context:
space:
mode:
authorRyan McQuen <rpcm@linux.com>2020-09-07 10:09:27 -0700
committerGitHub <noreply@github.com>2020-09-07 19:09:27 +0200
commit3286c5ec19ea5fb7ded81d047da5f8594108a490 (patch)
tree9a92a759a4d0ca283a8d174d3b4b60a6f5b6f606 /exercises/conversions
parentee7cdc66b31673c0fb02de0ce732812f855e69e8 (diff)
fix(using_as): Add test so that proper type is returned. (#512)
Diffstat (limited to 'exercises/conversions')
-rw-r--r--exercises/conversions/using_as.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/exercises/conversions/using_as.rs b/exercises/conversions/using_as.rs
index b3c197f..821309e 100644
--- a/exercises/conversions/using_as.rs
+++ b/exercises/conversions/using_as.rs
@@ -3,6 +3,7 @@
// It also helps with renaming imports.
//
// The goal is to make sure that the division does not fail to compile
+// and returns the proper type.
// I AM NOT DONE
@@ -15,3 +16,13 @@ fn main() {
let values = [3.5, 0.3, 13.0, 11.7];
println!("{}", average(&values));
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn returns_proper_type_and_value() {
+ assert_eq!(average(&[3.5, 0.3, 13.0, 11.7]), 7.125);
+ }
+}