aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ClickHouse/ch-go/proto/datetime_test.go
blob: 9d9d47986ea9720bec1cbaad1ccdbdb932274677 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package proto

import (
	"testing"
	"time"

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

func TestDateTime_Time(t *testing.T) {
	t.Run("Ok", func(t *testing.T) {
		v := time.Unix(1546290000, 0).UTC()
		d := ToDateTime(v)
		assert.Equal(t, int32(1546290000), int32(d))
	})
	t.Run("Zero", func(t *testing.T) {
		v := time.Time{}
		d := ToDateTime(v)
		assert.Equal(t, int32(0), int32(d))
	})
}