From 0544507d1944415039d93fd32105ab2984a1a5c3 Mon Sep 17 00:00:00 2001 From: Augusto Date: Mon, 22 Feb 2021 10:27:40 +0000 Subject: [PATCH] Update the test of the exercise `temperature_conv` --- rust/tests/temperature_conv_test/src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rust/tests/temperature_conv_test/src/main.rs b/rust/tests/temperature_conv_test/src/main.rs index c0c927f7..134a532a 100644 --- a/rust/tests/temperature_conv_test/src/main.rs +++ b/rust/tests/temperature_conv_test/src/main.rs @@ -8,13 +8,20 @@ fn eql(a: f64, b: f64) -> bool { #[test] fn test_f_to_c() { - println!("{}", fahrenheit_to_celsius(83.0)); - assert!(eql(fahrenheit_to_celsius(20.0), -6.666666666666666)); - assert!(eql(fahrenheit_to_celsius(83.0), 28.333333333333332)); + let temp_f = 20.0; + println!("{}°F = {}°C", temp_f, fahrenheit_to_celsius(temp_f)); + assert!(eql(fahrenheit_to_celsius(temp_f), -6.666666666666666)); + let temp_f = 83.0; + println!("{}°F = {}°C", temp_f, fahrenheit_to_celsius(temp_f)); + assert!(eql(fahrenheit_to_celsius(temp_f), 28.333333333333332)); } #[test] fn test_c_to_f() { + let temp_c = 27.0; + println!("{}°C = {}°F", temp_c, fahrenheit_to_celsius(temp_c)); assert!(eql(celsius_to_fahrenheit(27.0), 80.6)); - assert!(eql(celsius_to_fahrenheit(0.0), 32.0)) + let temp_c = 0.0; + println!("{}°C = {}°F", temp_c, fahrenheit_to_celsius(temp_c)); + assert!(eql(celsius_to_fahrenheit(temp_c), 32.0)) }