Create a quick calculation and test to make sure it works.
This commit is contained in:
parent
de0f7b897e
commit
de201f3cfa
|
@ -1,3 +1,4 @@
|
||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
.idea
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "embedded-uptime"
|
name = "embedded-unit-converter"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Dorian Pula <dorian.pula@points.com>"]
|
authors = ["Dorian Pula <dorian.pula@points.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,7 +1,14 @@
|
||||||
|
fn convert_celsius_to_fahrenheit(celsius: f32) -> f32 {
|
||||||
|
celsius * 1.8 + 32.0
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
|
use super::convert_celsius_to_fahrenheit;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn it_works() {
|
fn conversion_celsius_to_fahrenheit() {
|
||||||
assert_eq!(2 + 2, 4);
|
assert_eq!(convert_celsius_to_fahrenheit(25.0), 77.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue