susumu.yata
null+****@clear*****
Mon Jun 22 17:06:05 JST 2015
susumu.yata 2015-06-22 17:06:05 +0900 (Mon, 22 Jun 2015) New Revision: 077094a5f4a62766dd68c72b1530d641afb44093 https://github.com/groonga/grngo/commit/077094a5f4a62766dd68c72b1530d641afb44093 Message: Add tests for Text and LongText. GitHub: #5 Modified files: grngo_test.go Modified: grngo_test.go (+116 -20) =================================================================== --- grngo_test.go 2015-06-22 21:10:05 +0900 (b32d18d) +++ grngo_test.go 2015-06-22 17:06:05 +0900 (c7e74d8) @@ -154,7 +154,7 @@ func TestDBCreateTableWithWGS84GeoPointKey(t *testing.T) { testDBCreateTableWithKey(t, "WGS84GeoPoint") } -func TestDBCreateTableWithTextKey(t *testing.T) { +func TestDBCreateTableWithShortTextKey(t *testing.T) { testDBCreateTableWithKey(t, "ShortText") } @@ -198,7 +198,7 @@ func TestDBCreateTableWithWGS84GeoPointRefKey(t *testing.T) { testDBCreateTableWithRefKey(t, "WGS84GeoPoint") } -func TestDBCreateTableWithTextRefKey(t *testing.T) { +func TestDBCreateTableWithShortTextRefKey(t *testing.T) { testDBCreateTableWithRefKey(t, "ShortText") } @@ -222,7 +222,7 @@ func TestDBCreateTableWithWGS84GeoPointRefValue(t *testing.T) { testDBCreateTableWithRefValue(t, "WGS84GeoPoint") } -func TestDBCreateTableWithTextRefValue(t *testing.T) { +func TestDBCreateTableWithShortTextRefValue(t *testing.T) { testDBCreateTableWithRefValue(t, "ShortText") } @@ -339,7 +339,7 @@ func TestTableInsertRowWithWGS84GeoPointKey(t *testing.T) { testTableInsertRow(t, "WGS84GeoPoint") } -func TestTableInsertRowWithTextKey(t *testing.T) { +func TestTableInsertRowWithShortTextKey(t *testing.T) { testTableInsertRow(t, "ShortText") } @@ -451,10 +451,18 @@ func TestTableCreateColumnForWGS84GeoPoint(t *testing.T) { testTableCreateScalarColumn(t, "WGS84GeoPoint") } -func TestTableCreateColumnForText(t *testing.T) { +func TestTableCreateColumnForShortText(t *testing.T) { testTableCreateScalarColumn(t, "ShortText") } +func TestTableCreateColumnForText(t *testing.T) { + testTableCreateScalarColumn(t, "Text") +} + +func TestTableCreateColumnForLongText(t *testing.T) { + testTableCreateScalarColumn(t, "LongText") +} + func TestTableCreateColumnForBoolVector(t *testing.T) { testTableCreateVectorColumn(t, "Bool") } @@ -475,10 +483,18 @@ func TestTableCreateColumnForWGS84GeoPointVector(t *testing.T) { testTableCreateVectorColumn(t, "WGS84GeoPoint") } -func TestTableCreateColumnForTextVector(t *testing.T) { +func TestTableCreateColumnForShortTextVector(t *testing.T) { testTableCreateVectorColumn(t, "ShortText") } +func TestTableCreateColumnForTextVector(t *testing.T) { + testTableCreateVectorColumn(t, "Text") +} + +func TestTableCreateColumnForLongTextVector(t *testing.T) { + testTableCreateVectorColumn(t, "LongText") +} + func TestTableCreateColumnForRefToBool(t *testing.T) { testTableCreateScalarRefColumn(t, "Bool") } @@ -499,7 +515,7 @@ func TestTableCreateColumnForRefToWGS84GeoPoint(t *testing.T) { testTableCreateScalarRefColumn(t, "WGS84GeoPoint") } -func TestTableCreateColumnForRefToText(t *testing.T) { +func TestTableCreateColumnForRefToShortText(t *testing.T) { testTableCreateScalarRefColumn(t, "ShortText") } @@ -523,7 +539,7 @@ func TestTableCreateColumnForRefToWGS84GeoPointVector(t *testing.T) { testTableCreateVectorRefColumn(t, "WGS84GeoPoint") } -func TestTableCreateColumnForRefToTextVector(t *testing.T) { +func TestTableCreateColumnForRefToShortTextVector(t *testing.T) { testTableCreateVectorRefColumn(t, "ShortText") } @@ -559,7 +575,7 @@ func generateRandomValue(valueType string) interface{} { latitude := MinLatitude + rand.Intn(MaxLatitude-MinLatitude+1) longitude := MinLongitude + rand.Intn(MaxLongitude-MinLongitude+1) return GeoPoint{int32(latitude), int32(longitude)} - case "ShortText": + case "ShortText", "Text", "LongText": return []byte(strconv.Itoa(rand.Int())) default: return nil @@ -643,7 +659,7 @@ func generateRandomVectorValue(valueType string) interface{} { value[i] = GeoPoint{int32(latitude), int32(longitude)} } return value - case "ShortText": + case "ShortText", "Text", "LongText": value := make([][]byte, size) for i := 0; i < size; i++ { value[i] = []byte(strconv.Itoa(rand.Int())) @@ -742,10 +758,18 @@ func TestColumnSetValueForWGS84GeoPoint(t *testing.T) { testColumnSetValueForScalar(t, "WGS84GeoPoint") } -func TestColumnSetValueForText(t *testing.T) { +func TestColumnSetValueForShortText(t *testing.T) { testColumnSetValueForScalar(t, "ShortText") } +func TestColumnSetValueForText(t *testing.T) { + testColumnSetValueForScalar(t, "Text") +} + +func TestColumnSetValueForLongText(t *testing.T) { + testColumnSetValueForScalar(t, "LongText") +} + func TestColumnSetValueForBoolVector(t *testing.T) { testColumnSetValueForVector(t, "Bool") } @@ -794,10 +818,18 @@ func TestColumnSetValueForWGS84GeoPointVector(t *testing.T) { testColumnSetValueForVector(t, "WGS84GeoPoint") } -func TestColumnSetValueForTextVector(t *testing.T) { +func TestColumnSetValueForShortTextVector(t *testing.T) { testColumnSetValueForVector(t, "ShortText") } +func TestColumnSetValueForTextVector(t *testing.T) { + testColumnSetValueForVector(t, "Text") +} + +func TestColumnSetValueForLongTextVector(t *testing.T) { + testColumnSetValueForVector(t, "LongText") +} + func testColumnGetValueForScalar(t *testing.T, valueType string) { dirPath, _, db, table, column := createTempColumn(t, "Table", nil, "Value", valueType, nil) @@ -897,10 +929,18 @@ func TestColumnGetValueForWGS84GeoPoint(t *testing.T) { testColumnGetValueForScalar(t, "WGS84GeoPoint") } -func TestColumnGetValueForText(t *testing.T) { +func TestColumnGetValueForShortText(t *testing.T) { testColumnGetValueForScalar(t, "ShortText") } +func TestColumnGetValueForText(t *testing.T) { + testColumnGetValueForScalar(t, "Text") +} + +func TestColumnGetValueForLongText(t *testing.T) { + testColumnGetValueForScalar(t, "LongText") +} + func TestColumnGetValueForBoolVector(t *testing.T) { testColumnGetValueForVector(t, "Bool") } @@ -949,10 +989,18 @@ func TestColumnGetValueForWGS84GeoPointVector(t *testing.T) { testColumnGetValueForVector(t, "WGS84GeoPoint") } -func TestColumnGetValueForTextVector(t *testing.T) { +func TestColumnGetValueForShortTextVector(t *testing.T) { testColumnGetValueForVector(t, "ShortText") } +func TestColumnGetValueForTextVector(t *testing.T) { + testColumnGetValueForVector(t, "Text") +} + +func TestColumnGetValueForLongTextVector(t *testing.T) { + testColumnGetValueForVector(t, "LongText") +} + var numTestRows = 100000 func benchmarkColumnSetValueForScalar(b *testing.B, valueType string) { @@ -1041,10 +1089,18 @@ func BenchmarkColumnSetValueForWGS84GeoPoint(b *testing.B) { benchmarkColumnSetValueForScalar(b, "WGS84GeoPoint") } -func BenchmarkColumnSetValueForText(b *testing.B) { +func BenchmarkColumnSetValueForShortText(b *testing.B) { benchmarkColumnSetValueForScalar(b, "ShortText") } +func BenchmarkColumnSetValueForText(b *testing.B) { + benchmarkColumnSetValueForScalar(b, "Text") +} + +func BenchmarkColumnSetValueForLongText(b *testing.B) { + benchmarkColumnSetValueForScalar(b, "LongText") +} + func BenchmarkColumnSetValueForBoolVector(b *testing.B) { benchmarkColumnSetValueForVector(b, "Bool") } @@ -1065,10 +1121,18 @@ func BenchmarkColumnSetValueForWGS84GeoPointVector(b *testing.B) { benchmarkColumnSetValueForVector(b, "WGS84GeoPoint") } -func BenchmarkColumnSetValueForTextVector(b *testing.B) { +func BenchmarkColumnSetValueForShortTextVector(b *testing.B) { benchmarkColumnSetValueForVector(b, "ShortText") } +func BenchmarkColumnSetValueForTextVector(b *testing.B) { + benchmarkColumnSetValueForVector(b, "Text") +} + +func BenchmarkColumnSetValueForLongTextVector(b *testing.B) { + benchmarkColumnSetValueForVector(b, "LongText") +} + func benchmarkColumnGetValueForScalar(b *testing.B, valueType string) { dirPath, _, db, table, column := createTempColumn(b, "Table", nil, "Value", valueType, nil) @@ -1143,10 +1207,18 @@ func BenchmarkColumnGetValueForWGS84GeoPoint(b *testing.B) { benchmarkColumnGetValueForScalar(b, "WGS84GeoPoint") } -func BenchmarkColumnGetValueForText(b *testing.B) { +func BenchmarkColumnGetValueForShortText(b *testing.B) { benchmarkColumnGetValueForScalar(b, "ShortText") } +func BenchmarkColumnGetValueForText(b *testing.B) { + benchmarkColumnGetValueForScalar(b, "Text") +} + +func BenchmarkColumnGetValueForLongText(b *testing.B) { + benchmarkColumnGetValueForScalar(b, "LongText") +} + func BenchmarkColumnGetValueForBoolVector(b *testing.B) { benchmarkColumnGetValueForVector(b, "Bool") } @@ -1167,10 +1239,18 @@ func BenchmarkColumnGetValueForWGS84GeoPointVector(b *testing.B) { benchmarkColumnGetValueForVector(b, "WGS84GeoPoint") } -func BenchmarkColumnGetValueForTextVector(b *testing.B) { +func BenchmarkColumnGetValueForShortTextVector(b *testing.B) { benchmarkColumnGetValueForVector(b, "ShortText") } +func BenchmarkColumnGetValueForTextVector(b *testing.B) { + benchmarkColumnGetValueForVector(b, "Text") +} + +func BenchmarkColumnGetValueForLongTextVector(b *testing.B) { + benchmarkColumnGetValueForVector(b, "LongText") +} + func benchmarkDBSelectForScalar(b *testing.B, valueType string) { dirPath, _, db, table, column := createTempColumn(b, "Table", nil, "Value", valueType, nil) @@ -1246,10 +1326,18 @@ func BenchmarkDBSelectForWGS84GeoPoint(b *testing.B) { benchmarkDBSelectForScalar(b, "WGS84GeoPoint") } -func BenchmarkDBSelectForText(b *testing.B) { +func BenchmarkDBSelectForShortText(b *testing.B) { benchmarkDBSelectForScalar(b, "ShortText") } +func BenchmarkDBSelectForText(b *testing.B) { + benchmarkDBSelectForScalar(b, "Text") +} + +func BenchmarkDBSelectForLongText(b *testing.B) { + benchmarkDBSelectForScalar(b, "LongText") +} + func BenchmarkDBSelectForBoolVector(b *testing.B) { benchmarkDBSelectForVector(b, "Bool") } @@ -1270,6 +1358,14 @@ func BenchmarkDBSelectForWGS84GeoPointVector(b *testing.B) { benchmarkDBSelectForVector(b, "WGS84GeoPoint") } -func BenchmarkDBSelectForTextVector(b *testing.B) { +func BenchmarkDBSelectForShortTextVector(b *testing.B) { benchmarkDBSelectForVector(b, "ShortText") } + +func BenchmarkDBSelectForTextVector(b *testing.B) { + benchmarkDBSelectForVector(b, "Text") +} + +func BenchmarkDBSelectForLongTextVector(b *testing.B) { + benchmarkDBSelectForVector(b, "LongText") +} -------------- next part -------------- HTML����������������������������...Download