mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
25 lines
557 B
Go
25 lines
557 B
Go
package cautils
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFloat64ToInt(t *testing.T) {
|
|
assert.Equal(t, 3, Float64ToInt(3.49))
|
|
assert.Equal(t, 4, Float64ToInt(3.5))
|
|
assert.Equal(t, 4, Float64ToInt(3.51))
|
|
}
|
|
|
|
func TestFloat32ToInt(t *testing.T) {
|
|
assert.Equal(t, 3, Float32ToInt(3.49))
|
|
assert.Equal(t, 4, Float32ToInt(3.5))
|
|
assert.Equal(t, 4, Float32ToInt(3.51))
|
|
}
|
|
func TestFloat16ToInt(t *testing.T) {
|
|
assert.Equal(t, 3, Float16ToInt(3.49))
|
|
assert.Equal(t, 4, Float16ToInt(3.5))
|
|
assert.Equal(t, 4, Float16ToInt(3.51))
|
|
}
|