[前][次][番号順一覧][スレッド一覧]

ruby-changes:30594

From: akr <ko1@a...>
Date: Fri, 23 Aug 2013 22:46:30 +0900 (JST)
Subject: [ruby-changes:30594] akr:r42673 (trunk): add tests.

akr	2013-08-23 22:46:25 +0900 (Fri, 23 Aug 2013)

  New Revision: 42673

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42673

  Log:
    add tests.

  Modified files:
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 42672)
+++ test/ruby/test_process.rb	(revision 42673)
@@ -1669,4 +1669,64 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1669
     assert_raise(Errno::EINVAL) { Process.clock_gettime(:foo) }
   end
 
+  def test_clock_gettime_constants
+    Process.constants.grep(/\ACLOCK_/).each {|n|
+      c = Process.const_get(n)
+      begin
+        t = Process.clock_gettime(c)
+      rescue Errno::EINVAL
+        next
+      end
+      assert_kind_of(Float, t, "Process.clock_gettime(Process::#{n})")
+    }
+  end
+
+  def test_clock_gettime_SUS_GETTIMEOFDAY_BASED_CLOCK_REALTIME
+    n = :SUS_GETTIMEOFDAY_BASED_CLOCK_REALTIME
+    t = Process.clock_gettime(n)
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
+  def test_clock_gettime_ISO_C_TIME_BASED_CLOCK_REALTIME
+    n = :ISO_C_TIME_BASED_CLOCK_REALTIME
+    t = Process.clock_gettime(n)
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
+  def test_clock_gettime_SUS_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+    n = :SUS_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+    begin
+      t = Process.clock_gettime(n)
+    rescue Errno::EINVAL
+      return
+    end
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
+  def test_clock_gettime_POSIX_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+    n = :POSIX_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+    begin
+      t = Process.clock_gettime(n)
+    rescue Errno::EINVAL
+      return
+    end
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
+  def test_clock_gettime_ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+    n = :ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+    t = Process.clock_gettime(n)
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
+  def test_clock_gettime_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+    n = :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC
+    begin
+      t = Process.clock_gettime(n)
+    rescue Errno::EINVAL
+      return
+    end
+    assert_kind_of(Float, t, "Process.clock_gettime(:#{n})")
+  end
+
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]