[Groonga-commit] groonga/groonga [master] test: simplify the condition part

Back to archive index

null+****@clear***** null+****@clear*****
2012年 5月 16日 (水) 18:37:01 JST


HAYASHI Kentaro	2012-05-16 18:37:01 +0900 (Wed, 16 May 2012)

  New Revision: a2064e3d15bec46de2c7c8e73f0b14d01e727e83

  Log:
    test: simplify the condition part

  Modified files:
    test/function/tools/geo/generate-grntest-data.rb

  Modified: test/function/tools/geo/generate-grntest-data.rb (+5 -5)
===================================================================
--- test/function/tools/geo/generate-grntest-data.rb    2012-05-16 18:22:08 +0900 (800b782)
+++ test/function/tools/geo/generate-grntest-data.rb    2012-05-16 18:37:01 +0900 (69f81f3)
@@ -148,12 +148,12 @@ class GrnTestData
   end
 
   def long?(start_lng_deg, end_lng_deg)
+    diff_in_longitude = start_lng_deg.abs + end_lng_deg.to_i.abs
+    east_to_west = start_lng_deg > 0 and end_lng_deg.to_i < 0
+    west_to_east = start_lng_deg < 0 and end_lng_deg.to_i > 0
     if start_lng_deg != end_lng_deg and
-        ((start_lng_deg > 0 and end_lng_deg.to_i < 0) or
-        (start_lng_deg < 0 and end_lng_deg.to_i > 0)) and
-        start_lng_deg.abs + end_lng_deg.to_i.abs > 180
-      # the difference in longitude striding accross meridian is over
-      # 180 degree.
+        (east_to_west or west_to_east) and
+        diff_in_longitude > 180
       true
     else
       false




Groonga-commit メーリングリストの案内
Back to archive index