[Groonga-commit] groonga/grnxx at 5766ea9 [master] Add a test for Float::next_toward(). (#99)

Back to archive index

susumu.yata null+****@clear*****
Tue Dec 16 10:41:21 JST 2014


susumu.yata	2014-11-06 17:21:21 +0900 (Thu, 06 Nov 2014)

  New Revision: 5766ea93f01f1aad14b92571270280515ef20c8f
  https://github.com/groonga/grnxx/commit/5766ea93f01f1aad14b92571270280515ef20c8f

  Message:
    Add a test for Float::next_toward(). (#99)

  Modified files:
    test/test_data_types.cpp

  Modified: test/test_data_types.cpp (+16 -0)
===================================================================
--- test/test_data_types.cpp    2014-11-06 17:19:46 +0900 (32eb411)
+++ test/test_data_types.cpp    2014-11-06 17:21:21 +0900 (de5eee4)
@@ -720,6 +720,22 @@ void test_float() {
   assert((grnxx::Float::na() >= grnxx::Float::max()).is_na());
   assert((grnxx::Float::na() >= grnxx::Float::infinity()).is_na());
   assert((grnxx::Float::na() >= grnxx::Float::na()).is_na());
+
+  assert((grnxx::Float(0.0).next_toward(grnxx::Float::max())) ==
+         grnxx::Float::subnormal_min());
+  assert((grnxx::Float(0.0).next_toward(-grnxx::Float::max())) ==
+         -grnxx::Float::subnormal_min());
+  assert((grnxx::Float(0.0).next_toward(grnxx::Float::infinity())) ==
+         grnxx::Float::subnormal_min());
+  assert((grnxx::Float(0.0).next_toward(-grnxx::Float::infinity())) ==
+         -grnxx::Float::subnormal_min());
+  assert((grnxx::Float::infinity().next_toward(grnxx::Float(0.0)))
+         == grnxx::Float::max());
+  assert((-grnxx::Float::infinity().next_toward(grnxx::Float(0.0)))
+         == -grnxx::Float::max());
+  assert((grnxx::Float(0.0).next_toward(grnxx::Float::na())).is_na());
+  assert((grnxx::Float::na().next_toward(grnxx::Float(0.0))).is_na());
+  assert((grnxx::Float::na().next_toward(grnxx::Float::na())).is_na());
 }
 
 void test_geo_point() {
-------------- next part --------------
HTML����������������������������...
下载 



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