Skip to content

Commit f7bd2b1

Browse files
author
James Cor
committed
move tests
1 parent 922e485 commit f7bd2b1

File tree

2 files changed

+53
-34
lines changed

2 files changed

+53
-34
lines changed

sql/cache_test.go

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
package sql
1616

1717
import (
18-
"context"
1918
"errors"
2019
"testing"
2120

22-
"github.com/stretchr/testify/require"
21+
"github.com/stretchr/testify/require"
2322
)
2423

2524
func TestLRUCache(t *testing.T) {
@@ -178,35 +177,3 @@ func TestRowsCache(t *testing.T) {
178177
require.True(freed)
179178
})
180179
}
181-
182-
func BenchmarkHashOf(b *testing.B) {
183-
ctx := context.Background()
184-
row := NewRow(1, "1")
185-
b.ResetTimer()
186-
for i := 0; i < b.N; i++ {
187-
sum, err := HashOf(ctx, row)
188-
if err != nil {
189-
b.Fatal(err)
190-
}
191-
if sum != 11268758894040352165 {
192-
b.Fatalf("got %v", sum)
193-
}
194-
}
195-
}
196-
197-
func BenchmarkParallelHashOf(b *testing.B) {
198-
ctx := context.Background()
199-
row := NewRow(1, "1")
200-
b.ResetTimer()
201-
b.RunParallel(func(pb *testing.PB) {
202-
for pb.Next() {
203-
sum, err := HashOf(ctx, row)
204-
if err != nil {
205-
b.Fatal(err)
206-
}
207-
if sum != 11268758894040352165 {
208-
b.Fatalf("got %v", sum)
209-
}
210-
}
211-
})
212-
}

sql/hash/hash_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2025 Dolthub, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package hash
16+
17+
import(
18+
"testing"
19+
20+
"github.com/dolthub/go-mysql-server/sql"
21+
)
22+
func BenchmarkHashOf(b *testing.B) {
23+
ctx := sql.NewEmptyContext()
24+
row := sql.NewRow(1, "1")
25+
b.ResetTimer()
26+
for i := 0; i < b.N; i++ {
27+
sum, err := HashOf(ctx, nil, row)
28+
if err != nil {
29+
b.Fatal(err)
30+
}
31+
if sum != 11268758894040352165 {
32+
b.Fatalf("got %v", sum)
33+
}
34+
}
35+
}
36+
37+
func BenchmarkParallelHashOf(b *testing.B) {
38+
ctx := sql.NewEmptyContext()
39+
row := sql.NewRow(1, "1")
40+
b.ResetTimer()
41+
b.RunParallel(func(pb *testing.PB) {
42+
for pb.Next() {
43+
sum, err := HashOf(ctx, nil, row)
44+
if err != nil {
45+
b.Fatal(err)
46+
}
47+
if sum != 11268758894040352165 {
48+
b.Fatalf("got %v", sum)
49+
}
50+
}
51+
})
52+
}

0 commit comments

Comments
 (0)