[Groonga-commit] groonga/grngo at 032676f [master] Add tests for setting (U)IntXX vector values.

Back to archive index

susumu.yata null+****@clear*****
Mon Jun 22 16:11:51 JST 2015


susumu.yata	2015-06-22 16:11:51 +0900 (Mon, 22 Jun 2015)

  New Revision: 032676fd8ba23f0150dd522c07c770a96fb38abf
  https://github.com/groonga/grngo/commit/032676fd8ba23f0150dd522c07c770a96fb38abf

  Message:
    Add tests for setting (U)IntXX vector values.

  Modified files:
    grngo_test.go

  Modified: grngo_test.go (+71 -1)
===================================================================
--- grngo_test.go    2015-06-22 15:58:52 +0900 (a25ce05)
+++ grngo_test.go    2015-06-22 16:11:51 +0900 (4a9f393)
@@ -539,12 +539,54 @@ func generateRandomVectorValue(valueType string) interface{} {
 			value[i] = (rand.Int() & 1) == 1
 		}
 		return value
+	case "Int8":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(int8(rand.Int()))
+		}
+		return value
+	case "Int16":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(int16(rand.Int()))
+		}
+		return value
+	case "Int32":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(int32(rand.Int()))
+		}
+		return value
 	case "Int64":
 		value := make([]int64, size)
 		for i := 0; i < size; i++ {
 			value[i] = rand.Int63()
 		}
 		return value
+	case "UInt8":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(uint8(rand.Int()))
+		}
+		return value
+	case "UInt16":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(uint16(rand.Int()))
+		}
+		return value
+	case "UInt32":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = int64(rand.Uint32())
+		}
+		return value
+	case "UInt64":
+		value := make([]int64, size)
+		for i := 0; i < size; i++ {
+			value[i] = rand.Int63()
+		}
+		return value
 	case "Float":
 		value := make([]float64, size)
 		for i := 0; i < size; i++ {
@@ -668,10 +710,38 @@ func TestColumnSetValueForBoolVector(t *testing.T) {
 	testColumnSetValueForVector(t, "Bool")
 }
 
-func TestColumnSetValueForIntVector(t *testing.T) {
+func TestColumnSetValueForInt8Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "Int8")
+}
+
+func TestColumnSetValueForInt16Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "Int16")
+}
+
+func TestColumnSetValueForInt32Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "Int32")
+}
+
+func TestColumnSetValueForInt64Vector(t *testing.T) {
 	testColumnSetValueForVector(t, "Int64")
 }
 
+func TestColumnSetValueForUInt8Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "UInt8")
+}
+
+func TestColumnSetValueForUInt16Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "UInt16")
+}
+
+func TestColumnSetValueForUInt32Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "UInt32")
+}
+
+func TestColumnSetValueForUInt64Vector(t *testing.T) {
+	testColumnSetValueForVector(t, "UInt64")
+}
+
 func TestColumnSetValueForFloatVector(t *testing.T) {
 	testColumnSetValueForVector(t, "Float")
 }
-------------- next part --------------
HTML����������������������������...
Descargar 



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