From 736a99328495c8937be31385c20cd66674d62964 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Thu, 19 Apr 2018 08:25:51 +0300 Subject: [PATCH] h-gtk: Move forgotten test from a68987f2577bbe63060028f085c50da9b4a48261 --- hammond-gtk/src/settings.rs | 18 ++++++++++++++++++ hammond-gtk/src/utils.rs | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hammond-gtk/src/settings.rs b/hammond-gtk/src/settings.rs index 1522f0a..9c39c1d 100644 --- a/hammond-gtk/src/settings.rs +++ b/hammond-gtk/src/settings.rs @@ -95,6 +95,24 @@ pub fn time_period_to_duration(time: i64, period: &str) -> Duration { } } +#[test] +fn test_time_period_to_duration() { + let time = 2; + let week = 604800 * time; + let day = 86400 * time; + let hour = 3600 * time; + let minute = 60 * time; + + assert_eq!(week, time_period_to_duration(time, "weeks").num_seconds()); + assert_eq!(day, time_period_to_duration(time, "days").num_seconds()); + assert_eq!(hour, time_period_to_duration(time, "hours").num_seconds()); + assert_eq!( + minute, + time_period_to_duration(time, "minutes").num_seconds() + ); + assert_eq!(time, time_period_to_duration(time, "seconds").num_seconds()); +} + // #[test] // fn test_apply_window_geometry() { // gtk::init().expect("Error initializing gtk."); diff --git a/hammond-gtk/src/utils.rs b/hammond-gtk/src/utils.rs index a86fe9e..e6675f1 100644 --- a/hammond-gtk/src/utils.rs +++ b/hammond-gtk/src/utils.rs @@ -303,24 +303,6 @@ mod tests { // use hammond_data::Source; // use hammond_data::dbqueries; - #[test] - fn test_time_period_to_duration() { - let time = 2; - let week = 604800 * time; - let day = 86400 * time; - let hour = 3600 * time; - let minute = 60 * time; - - assert_eq!(week, time_period_to_duration(time, "weeks").num_seconds()); - assert_eq!(day, time_period_to_duration(time, "days").num_seconds()); - assert_eq!(hour, time_period_to_duration(time, "hours").num_seconds()); - assert_eq!( - minute, - time_period_to_duration(time, "minutes").num_seconds() - ); - assert_eq!(time, time_period_to_duration(time, "seconds").num_seconds()); - } - // #[test] // This test inserts an rss feed to your `XDG_DATA/hammond/hammond.db` so we make it explicit // to run it.