Kentaro Hayashi
null+****@clear*****
Mon Jul 3 12:02:23 JST 2017
Kentaro Hayashi 2017-07-03 12:02:23 +0900 (Mon, 03 Jul 2017) New Revision: e62abcc1544ba71b91c18cd8bb701a2a48bc9acc https://github.com/groonga/groonga/commit/e62abcc1544ba71b91c18cd8bb701a2a48bc9acc Merged 469ab17: Merge pull request #721 from kenhys/support-abs Message: test: add math_abs() test cases Added files: test/command/suite/select/function/math_abs/float.expected test/command/suite/select/function/math_abs/float.test test/command/suite/select/function/math_abs/int16/max.expected test/command/suite/select/function/math_abs/int16/max.test test/command/suite/select/function/math_abs/int16/min.expected test/command/suite/select/function/math_abs/int16/min.test test/command/suite/select/function/math_abs/int32/max.expected test/command/suite/select/function/math_abs/int32/max.test test/command/suite/select/function/math_abs/int32/min.expected test/command/suite/select/function/math_abs/int32/min.test test/command/suite/select/function/math_abs/int64/max.expected test/command/suite/select/function/math_abs/int64/max.test test/command/suite/select/function/math_abs/int64/min.expected test/command/suite/select/function/math_abs/int64/min.test test/command/suite/select/function/math_abs/int8/max.expected test/command/suite/select/function/math_abs/int8/max.test test/command/suite/select/function/math_abs/int8/min.expected test/command/suite/select/function/math_abs/int8/min.test test/command/suite/select/function/math_abs/no_argument.expected test/command/suite/select/function/math_abs/no_argument.test test/command/suite/select/function/math_abs/uint16/max.expected test/command/suite/select/function/math_abs/uint16/max.test test/command/suite/select/function/math_abs/uint32/max.expected test/command/suite/select/function/math_abs/uint32/max.test test/command/suite/select/function/math_abs/uint8/max.expected test/command/suite/select/function/math_abs/uint8/max.test Modified files: plugins/functions/math.c Modified: plugins/functions/math.c (+1 -1) =================================================================== --- plugins/functions/math.c 2017-07-03 12:00:05 +0900 (6aea87c) +++ plugins/functions/math.c 2017-07-03 12:02:23 +0900 (942e8ff) @@ -84,7 +84,7 @@ func_math_abs(grn_ctx *ctx, int n_args, grn_obj **args, ABS_CONVERT_TYPE(labs, GRN_DB_UINT32, uint32_t, GRN_INT32_VALUE, GRN_UINT32_SET); break; case GRN_DB_UINT32: - ABS_CONVERT_TYPE(labs, GRN_DB_UINT32, uint32_t, GRN_UINT32_VALUE, GRN_UINT32_SET); + ABS_CONVERT_TYPE(llabs, GRN_DB_UINT32, uint32_t, GRN_UINT32_VALUE, GRN_UINT32_SET); break; case GRN_DB_INT64: ABS_CONVERT_TYPE(llabs, GRN_DB_UINT64, uint64_t, GRN_INT64_VALUE, GRN_UINT64_SET); Added: test/command/suite/select/function/math_abs/float.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/float.expected 2017-07-03 12:02:23 +0900 (5635025) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Float +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-3.14} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[3.14]]]] Added: test/command/suite/select/function/math_abs/float.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/float.test 2017-07-03 12:02:23 +0900 (789f4f7) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Float + +load --table Values +[ +{"value":-3.14} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int16/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int16/max.expected 2017-07-03 12:02:23 +0900 (3d5ac6e) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int16 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":32767} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[32767]]]] Added: test/command/suite/select/function/math_abs/int16/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int16/max.test 2017-07-03 12:02:23 +0900 (c203ecf) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int16 + +load --table Values +[ +{"value":32767} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int16/min.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int16/min.expected 2017-07-03 12:02:23 +0900 (c02adf3) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int16 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-32768} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[32768]]]] Added: test/command/suite/select/function/math_abs/int16/min.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int16/min.test 2017-07-03 12:02:23 +0900 (11212dc) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int16 + +load --table Values +[ +{"value":-32768} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int32/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int32/max.expected 2017-07-03 12:02:23 +0900 (aed8137) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int32 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":2147483647} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[2147483647]]]] Added: test/command/suite/select/function/math_abs/int32/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int32/max.test 2017-07-03 12:02:23 +0900 (91fedd5) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int32 + +load --table Values +[ +{"value":2147483647} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int32/min.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int32/min.expected 2017-07-03 12:02:23 +0900 (7550ab0) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int32 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-2147483648} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[2147483648]]]] Added: test/command/suite/select/function/math_abs/int32/min.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int32/min.test 2017-07-03 12:02:23 +0900 (e0e9338) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int32 + +load --table Values +[ +{"value":-2147483648} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int64/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int64/max.expected 2017-07-03 12:02:23 +0900 (e115a93) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":9223372036854775807} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[9223372036854775807]]]] Added: test/command/suite/select/function/math_abs/int64/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int64/max.test 2017-07-03 12:02:23 +0900 (f9807be) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int64 + +load --table Values +[ +{"value":9223372036854775807} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int64/min.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int64/min.expected 2017-07-03 12:02:23 +0900 (374c6db) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-9223372036854775808} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[9223372036854775808]]]] Added: test/command/suite/select/function/math_abs/int64/min.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int64/min.test 2017-07-03 12:02:23 +0900 (b2469f7) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int64 + +load --table Values +[ +{"value":-9223372036854775808} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int8/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int8/max.expected 2017-07-03 12:02:23 +0900 (0bf3282) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +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":127} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[127]]]] Added: test/command/suite/select/function/math_abs/int8/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int8/max.test 2017-07-03 12:02:23 +0900 (8e5493f) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int8 + +load --table Values +[ +{"value":127} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/int8/min.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int8/min.expected 2017-07-03 12:02:23 +0900 (39cb564) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +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":-128} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[128]]]] Added: test/command/suite/select/function/math_abs/int8/min.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/int8/min.test 2017-07-03 12:02:23 +0900 (c6d73dc) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int8 + +load --table Values +[ +{"value":-128} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/no_argument.expected (+22 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/no_argument.expected 2017-07-03 12:02:23 +0900 (0e2c9b4) @@ -0,0 +1,22 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +load --table Values +[ +{} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = math_abs()' +[ + [ + [ + -22, + 0.0, + 0.0 + ], + "[select][scorer] failed to execute: <_score = math_abs()>: math_abs(): wrong number of arguments (0 for 1)" + ] +] +#|e| math_abs(): wrong number of arguments (0 for 1) +#|e| [select][scorer] failed to execute: <_score = math_abs()>: math_abs(): wrong number of arguments (0 for 1) Added: test/command/suite/select/function/math_abs/no_argument.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/no_argument.test 2017-07-03 12:02:23 +0900 (dbb0b1a) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY + +load --table Values +[ +{} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = math_abs()' Added: test/command/suite/select/function/math_abs/uint16/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint16/max.expected 2017-07-03 12:02:23 +0900 (264baf4) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt16 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":65535} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[65535]]]] Added: test/command/suite/select/function/math_abs/uint16/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint16/max.test 2017-07-03 12:02:23 +0900 (784a40d) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt16 + +load --table Values +[ +{"value":65535} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/uint32/max.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint32/max.expected 2017-07-03 12:02:23 +0900 (dc8682c) @@ -0,0 +1,13 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":4294967295} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[4294967295]]]] Added: test/command/suite/select/function/math_abs/uint32/max.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint32/max.test 2017-07-03 12:02:23 +0900 (85effa5) @@ -0,0 +1,13 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt32 + +load --table Values +[ +{"value":4294967295} +] + +select Values \ + --filter true \ + --output_columns 'math_abs(value)' Added: test/command/suite/select/function/math_abs/uint8/max.expected (+15 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint8/max.expected 2017-07-03 12:02:23 +0900 (b3d16d6) @@ -0,0 +1,15 @@ +plugin_register functions/math +[[0,0.0,0.0],true] +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt8 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":255} +] +[[0,0.0,0.0],1] +select Values +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["value","UInt8"]],[1,255]]]] +select Values --filter true --output_columns 'math_abs(value)' +[[0,0.0,0.0],[[[1],[["math_abs",null]],[255]]]] Added: test/command/suite/select/function/math_abs/uint8/max.test (+14 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/math_abs/uint8/max.test 2017-07-03 12:02:23 +0900 (1a6941d) @@ -0,0 +1,14 @@ +plugin_register functions/math + +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt8 + +load --table Values +[ +{"value":255} +] + +select Values +select Values \ + --filter true \ + --output_columns 'math_abs(value)' -------------- next part -------------- HTML����������������������������...Download