|
Freya
0.0.1
A Gtk3 MPD Client
|
00001 /*********************************************************** 00002 * This file is part of Freya 00003 * - A free MPD Gtk3 MPD Client - 00004 * 00005 * Authors: Christopher Pahl, Christoph Piechula, 00006 * Eduard Schneider 00007 * 00008 * Copyright (C) [2011-2012] 00009 * Hosted at: https://github.com/studentkittens/Freya 00010 * 00011 * __..--''``---....___ _..._ __ 00012 * /// //_.-' .-/"; ` ``<._ ``.''_ `. / // / 00013 * ///_.-' _..--.'_ `( ) ) // // 00014 * / (_..-' // (< _ ;_..__ ; `' / /// 00015 * / // // // `-._,_)' // / ``--...____..-' /// / // 00016 * Ascii-Art by Felix Lee <flee@cse.psu.edu> 00017 * 00018 * Freya is free software: you can redistribute it and/or modify 00019 * it under the terms of the GNU General Public License as published by 00020 * the Free Software Foundation, either version 3 of the License, or 00021 * (at your option) any later version. 00022 * 00023 * Freya is distributed in the hope that it will be useful, 00024 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00026 * GNU General Public License for more details. 00027 * 00028 * You should have received a copy of the GNU General Public License 00029 * along with Freya. If not, see <http://www.gnu.org/licenses/>. 00030 **************************************************************/ 00031 #ifndef FREYA_CXX_UTILS_GUARD 00032 #define FREYA_CXX_UTILS_GUARD 00033 00034 #include "Utils.hh" 00035 00036 class UtilsTestSuite : public CxxTest::TestSuite 00037 { 00038 00039 public: 00040 //------------------------------------------------------------- 00041 // Utils::seconds_to_duration(unsinged long) 00042 void testseconds_to_duration_1_year() 00043 { 00044 TS_ASSERT("52 weeks 1 days 0 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(60/*seconds*/ * 60/*minutes*/ * 24/*hours*/ * 365/*days*/)); 00045 } 00046 void testseconds_to_duration_check_if_always_the_same() 00047 { 00048 TS_ASSERT(Utils::seconds_to_duration(60*60*24*365) == Utils::seconds_to_duration(60*60*24*365)); 00049 } 00050 void testseconds_to_duration_1_second() 00051 { 00052 TS_ASSERT("0 hours 0 minutes 1 seconds" == Utils::seconds_to_duration(1)); 00053 } 00054 void testseconds_to_duration_0_seconds() 00055 { 00056 TS_ASSERT("0 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(0)); 00057 } 00058 void testseconds_to_duration_1_minutes() 00059 { 00060 TS_ASSERT("0 hours 1 minutes 0 seconds" == Utils::seconds_to_duration(60)); 00061 } 00062 void testseconds_to_duration_2_minutes() 00063 { 00064 TS_ASSERT("0 hours 2 minutes 0 seconds" == Utils::seconds_to_duration(120)); 00065 } 00066 void testseconds_to_duration_1_hour() 00067 { 00068 TS_ASSERT("1 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(3600)); 00069 } 00070 void testseconds_to_duration_2_hours() 00071 { 00072 TS_ASSERT("2 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(7200)); 00073 } 00074 void testseconds_to_duration_1_day() 00075 { 00076 TS_ASSERT("1 days 0 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(3600*24)); 00077 } 00078 void testseconds_to_duration_2_days() 00079 { 00080 TS_ASSERT("2 days 0 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(2*3600*24)); 00081 } 00082 void testseconds_to_duration_2_years() 00083 { 00084 TS_ASSERT("104 weeks 2 days 0 hours 0 minutes 0 seconds" == Utils::seconds_to_duration(2*60*60*24*365)); 00085 } 00086 00087 00088 //------------------------------------------------------------- 00089 // Utils::seconds_to_timestamp(const long) 00090 void testseconds_to_timestamp_date1(void) 00091 { 00092 TS_ASSERT("2011-12-05" == Utils::seconds_to_timestamp(1323039600)); 00093 } 00094 }; 00095 00096 00097 00098 00099 #endif
1.8.0