[Groonga-commit] droonga/drntest at 687823e [master] Normalize Groonga command's header values only if the values are valid

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Nov 22 16:17:43 JST 2013


Kouhei Sutou	2013-11-22 16:17:43 +0900 (Fri, 22 Nov 2013)

  New Revision: 687823ed536fa1ad2b31ebb7641d55be2689e968
  https://github.com/droonga/drntest/commit/687823ed536fa1ad2b31ebb7641d55be2689e968

  Message:
    Normalize Groonga command's header values only if the values are valid
    
    It is helpful to find invalid values.

  Modified files:
    lib/drntest/executor.rb

  Modified: lib/drntest/executor.rb (+10 -2)
===================================================================
--- lib/drntest/executor.rb    2013-11-22 16:13:52 +0900 (0a9cad1)
+++ lib/drntest/executor.rb    2013-11-22 16:17:43 +0900 (05f2b5c)
@@ -68,8 +68,16 @@ module Drntest
     def normalize_groonga_command_header!(header)
       normalized_start_time = 0.0
       normalized_elapsed = 0.0
-      header[1] = normalized_start_time
-      header[2] = normalized_elapsed
+      header[1] = normalized_start_time if valid_start_time?(header[1])
+      header[2] = normalized_elapsed if valid_elapsed?(header[2])
+    end
+
+    def valid_start_time?(start_time)
+      start_time.is_a?(Float) and start_time > 0
+    end
+
+    def valid_elapsed?(elapsed)
+      elapsed.is_a?(Float) and elapsed > 0
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index