unittests/tests/utils.js
author hamidouk
Wed, 16 Nov 2011 11:20:52 +0100
branchpopcorn-port
changeset 252 fd84e0fb26d8
child 253 95c6b77f005e
permissions -rw-r--r--
added a function to convert a number of seconds to an hour, minutes, seconds.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
252
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     1
function test_utils() {
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     2
  module("Utility function tests");
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     3
  
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     4
  test("test function to convert from seconds to a time", function() {
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     5
    var h = 13, m = 7, s = 41;
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     6
    var t = 13 * 3600 + 7* 60 + 41;
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     7
    deepEqual(IriSP.secondsToTime(t), [h, m, s], "the converted time is correct");
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     8
    
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
     9
    t = -t;
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
    10
    deepEqual(IriSP.secondsToTime(t), [h, m, s], "the function is immune to negative numbers.");
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
    11
  });
fd84e0fb26d8 added a function to convert a number of seconds to an hour, minutes, seconds.
hamidouk
parents:
diff changeset
    12
}