Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed Jun 13, 2024
1 parent faf9d6c commit 282e30a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions clients/bigquery/storagewrite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package bigquery

import (
"testing"
"time"

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

func TestEncodePacked64TimeMicros(t *testing.T) {
epoch := time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)

assert.Equal(t, int64(0), encodePacked64TimeMicros(epoch))
assert.Equal(t, int64(1), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Microsecond)))
assert.Equal(t, int64(1000), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Millisecond)))
assert.Equal(t, int64(1<<20), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Second)))
assert.Equal(t, int64(1<<26), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Minute)))
assert.Equal(t, int64(1<<32), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Hour)))
assert.Equal(t, int64(1<<32+1), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Hour+time.Duration(1)*time.Microsecond)))
assert.Equal(t, int64(1<<32+1000), encodePacked64TimeMicros(epoch.Add(time.Duration(1)*time.Hour+time.Duration(1)*time.Millisecond)))
}

0 comments on commit 282e30a

Please sign in to comment.