Skip to content

Commit

Permalink
test(proto): improve LowCardinalityOf test
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Apr 19, 2022
1 parent 63a2452 commit 5bbcb8b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions proto/col_low_cardinality_of_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/go-faster/ch/internal/gold"
Expand All @@ -19,7 +20,8 @@ func TestLowCardinalityOf(t *testing.T) {

func TestLowCardinalityOfStr(t *testing.T) {
col := (&ColStr{}).LowCardinality()
col.AppendArr([]string{"foo", "bar", "foo", "foo", "baz"})
v := []string{"foo", "bar", "foo", "foo", "baz"}
col.AppendArr(v)

require.NoError(t, col.Prepare())

Expand All @@ -35,7 +37,10 @@ func TestLowCardinalityOfStr(t *testing.T) {

require.NoError(t, dec.DecodeColumn(r, col.Rows()))
require.Equal(t, col.Rows(), dec.Rows())
require.Equal(t, ColumnType("LowCardinality(String)"), dec.Type())
for i, s := range v {
assert.Equal(t, s, col.Row(i))
}
assert.Equal(t, ColumnType("LowCardinality(String)"), dec.Type())
})
t.Run("ErrUnexpectedEOF", func(t *testing.T) {
r := NewReader(bytes.NewReader(nil))
Expand Down

0 comments on commit 5bbcb8b

Please sign in to comment.