[Groonga-commit] groonga/groonga [master] Add a test for unary operation for Int8 type

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 1 17:48:59 JST 2013


Kouhei Sutou	2013-03-01 17:48:59 +0900 (Fri, 01 Mar 2013)

  New Revision: e83b51e63aef03168888424879cead40d8fe950e
  https://github.com/groonga/groonga/commit/e83b51e63aef03168888424879cead40d8fe950e

  Log:
    Add a test for unary operation for Int8 type
    
    Operation: -X

  Added files:
    test/command/suite/select/operation/unary_minus/int8.expected
    test/command/suite/select/operation/unary_minus/int8.test
  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+8 -0)
===================================================================
--- lib/expr.c    2013-03-01 15:12:34 +0900 (d7a0ee6)
+++ lib/expr.c    2013-03-01 17:48:59 +0900 (1dc4eee)
@@ -2145,6 +2145,14 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
   POP1ALLOC1(x, res);                                                   \
   res->header.domain = x->header.domain;                                \
   switch (x->header.domain) {                                           \
+  case GRN_DB_INT8 :                                                    \
+    {                                                                   \
+      int8_t x_;                                                        \
+      x_ = GRN_INT8_VALUE(x);                                           \
+      left_expression_check(x_);                                        \
+      GRN_INT8_SET(ctx, res, integer_operation(x_));                    \
+    }                                                                   \
+    break;                                                              \
   case GRN_DB_INT32 :                                                   \
     {                                                                   \
       int x_;                                                           \

  Added: test/command/suite/select/operation/unary_minus/int8.expected (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/operation/unary_minus/int8.expected    2013-03-01 17:48:59 +0900 (011f0d8)
@@ -0,0 +1,11 @@
+table_create Values TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Values value COLUMN_SCALAR Int8
+[[0,0.0,0.0],true]
+load --table Values
+[
+{"value": -1}
+]
+[[0,0.0,0.0],1]
+select Values   --filter true   --scorer '_score = -value'   --output_columns 'value, _score'
+[[0,0.0,0.0],[[[1],[["value","Int8"],["_score","Int32"]],[-1,1]]]]

  Added: test/command/suite/select/operation/unary_minus/int8.test (+12 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/operation/unary_minus/int8.test    2013-03-01 17:48:59 +0900 (ca031c2)
@@ -0,0 +1,12 @@
+table_create Values TABLE_NO_KEY
+column_create Values value COLUMN_SCALAR Int8
+
+load --table Values
+[
+{"value": -1}
+]
+
+select Values \
+  --filter true \
+  --scorer '_score = -value' \
+  --output_columns 'value, _score'
-------------- next part --------------
HTML����������������������������...
Download 



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