MCPcopy Create free account
hub / github.com/buke/quickjs-go / TestRuntimeNextClassObjectIDOverflowReturnsZero

Function TestRuntimeNextClassObjectIDOverflowReturnsZero

runtime_test.go:544–554  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

542}
543
544func TestRuntimeNextClassObjectIDOverflowReturnsZero(t *testing.T) {
545 const maxInt32 = int32(^uint32(0) >> 1)
546
547 rt := &Runtime{}
548 rt.classObjectIDCounter.Store(maxInt32 - 1)
549
550 first := rt.nextClassObjectID()
551 require.Equal(t, -(maxInt32), first)
552 second := rt.nextClassObjectID()
553 require.Zero(t, second)
554}
555
556func TestRuntimeRegisterClassObjectIdentityOverflowReturnsZero(t *testing.T) {
557 const maxInt32 = int32(^uint32(0) >> 1)

Callers

nothing calls this directly

Calls 3

nextClassObjectIDMethod · 0.95
StoreMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected