MCPcopy
hub / github.com/nats-io/nats.go / TestEncBuiltinMarshalFloat64

Function TestEncBuiltinMarshalFloat64

test/enc_test.go:211–234  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestEncBuiltinMarshalFloat64(t *testing.T) {
212 s := RunServerOnPort(TEST_PORT)
213 defer s.Shutdown()
214
215 ec := NewDefaultEConn(t)
216 defer ec.Close()
217 ch := make(chan bool)
218
219 testN := float64(22.22)
220
221 ec.Subscribe("enc_float", func(n float64) {
222 if n != testN {
223 t.Fatalf("Received test number of %f, wanted %f\n", n, testN)
224 }
225 ch <- true
226 })
227 ec.Publish("enc_float", testN)
228 if e := Wait(ch); e != nil {
229 if ec.LastError() != nil {
230 e = ec.LastError()
231 }
232 t.Fatalf("Did not receive the message: %s", e)
233 }
234}
235
236func TestEncBuiltinMarshalBool(t *testing.T) {
237 s := RunServerOnPort(TEST_PORT)

Callers

nothing calls this directly

Calls 8

NewDefaultEConnFunction · 0.85
FatalfMethod · 0.80
RunServerOnPortFunction · 0.70
WaitFunction · 0.70
SubscribeMethod · 0.65
PublishMethod · 0.65
CloseMethod · 0.45
LastErrorMethod · 0.45

Tested by

no test coverage detected