MCPcopy Index your code
hub / github.com/cortexlabs/cortex / TestInterfaceToInt

Function TestInterfaceToInt

pkg/lib/cast/interface_test.go:98–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestInterfaceToInt(t *testing.T) {
99 var out int
100 var ok bool
101
102 out, ok = InterfaceToInt(int(1))
103 require.True(t, ok)
104 require.Equal(t, int(1), out)
105
106 _, ok = InterfaceToInt(float32(2))
107 require.False(t, ok)
108
109 _, ok = InterfaceToInt("test")
110 require.False(t, ok)
111}
112
113func TestInterfaceToInt8Downcast(t *testing.T) {
114 var out int8

Callers

nothing calls this directly

Calls 2

InterfaceToIntFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected