MCPcopy
hub / github.com/gofiber/fiber / TestState_GetFloat64

Function TestState_GetFloat64

state_test.go:104–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestState_GetFloat64(t *testing.T) {
105 t.Parallel()
106 st := newState()
107
108 st.Set("pi", 3.14)
109 f, ok := st.GetFloat64("pi")
110 require.True(t, ok)
111 require.InDelta(t, 3.14, f, 0.0001)
112
113 // wrong type should return zero value
114 st.Set("int", 10)
115 f, ok = st.GetFloat64("int")
116 require.False(t, ok)
117 require.InDelta(t, 0.0, f, 0.0001)
118
119 // missing key should return zero value
120 f, ok = st.GetFloat64("missing")
121 require.False(t, ok)
122 require.InDelta(t, 0.0, f, 0.0001)
123}
124
125func TestState_GetUint(t *testing.T) {
126 t.Parallel()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetFloat64Method · 0.80
SetMethod · 0.65

Tested by

no test coverage detected