changeset 12836:e9b4de878a9c

codesprint: new tests for now function * now.m: New tests.
author John W. Eaton <jwe@octave.org>
date Sat, 16 Jul 2011 17:45:54 -0400
parents 0e65376cc44b
children 4dfc13ca35b9
files scripts/time/now.m
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/time/now.m
+++ b/scripts/time/now.m
@@ -37,7 +37,11 @@
 
 function t = now ()
 
-  t = datenum (clock ());
+  if (nargin == 0)
+    t = datenum (clock ());
+  else
+    print_usage ();
+  endif
 
   ## The following doesn't work (e.g., one hour off on 2005-10-04):
   ##
@@ -50,3 +54,8 @@
   ## changing by an hour the offset from CUT for part of the year.
 
 endfunction
+
+%!error now (1);
+%!assert (isnumeric (now ());
+%!assert (now () > 0);
+%!assert (now () >= now ());