diff --git a/tests/15time.tests b/tests/15time.tests new file mode 100644 index 000000000..8ee10499b --- /dev/null +++ b/tests/15time.tests @@ -0,0 +1,10 @@ +TESTING "Time conversion" ./test-time + +TEST "basic functionality" basic < + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +typedef unsigned int uint; + +#include "lib/time.h" +#include "tests/test.h" + +#include + +TESTS_BEGIN + +const int MILLIS = 700; +const int SECONDS = 20; +const int MINUTES = 55; +const int HOURS = 3; + +/* + * 1. Basic functionality + */ + +TEST (basic) { + // Zero + gavl_time_t t = lumiera_build_time(0,0,0,0); + ECHO ("%d", (int) t); + + // Non-zero + t = lumiera_build_time(MILLIS, SECONDS, MINUTES, HOURS); + + ECHO("%d", lumiera_time_millis(t) == MILLIS); + ECHO("%d", lumiera_time_seconds(t) != SECONDS); + ECHO("%d", lumiera_time_minutes(t) == MINUTES); + ECHO("%d", lumiera_time_hours(t) != HOURS); + + ECHO("%s", lumiera_tmpbuf_print_time(t)); +} + +TESTS_END