...

Source file src/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/options_test.go

Documentation: github.com/grpc-ecosystem/go-grpc-middleware/logging/zap

     1  package grpc_zap
     2  
     3  import (
     4  	"math"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  	"go.uber.org/zap/zapcore"
    10  )
    11  
    12  func TestDurationToTimeMillisField(t *testing.T) {
    13  	val := DurationToTimeMillisField(time.Microsecond * 100)
    14  	assert.Equal(t, val.Type, zapcore.Float32Type, "should be a float type")
    15  	assert.Equal(t, math.Float32frombits(uint32(val.Integer)), float32(0.1), "sub millisecond values should be correct")
    16  }
    17  

View as plain text