Permalink
Browse files

test duration format

  • Loading branch information...
JPMoresmau committed Jan 24, 2014
1 parent 28b360c commit cc96b256c97e02c272365ea31295692b9874e57b
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2014 by JP Moresmau
+ * This code is made available under the terms of the Eclipse Public License,
+ * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+ */
+package net.sf.eclipsefp.haskell.debug.core;
+
+
+import static org.junit.Assert.assertEquals;
+import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author JP Moresmau
+ *
+ */
+public class DurationTest {
+
+ @Test
+ public void testFormatDuration(){
+ assertEquals("999 ms",CoreTexts.formatDuration(999L));
+ assertEquals("1 second, 999 ms",CoreTexts.formatDuration(1999L));
+ assertEquals("2 seconds, 999 ms",CoreTexts.formatDuration(2999L));
+ assertEquals("1 minute, 2 seconds, 999 ms",CoreTexts.formatDuration(60000L+2999L));
+ assertEquals("2 minutes, 2 seconds, 999 ms",CoreTexts.formatDuration(2*60000L+2999L));
+ assertEquals("1 hour, 2 minutes, 2 seconds, 999 ms",CoreTexts.formatDuration(3600*1000+2*60000L+2999L));
+ assertEquals("2 hours, 2 minutes, 2 seconds, 999 ms",CoreTexts.formatDuration(3600*2000+2*60000L+2999L));
+
+ }
+}

0 comments on commit cc96b25

Please sign in to comment.