mirror of
https://github.com/pion/stun.git
synced 2025-09-26 20:01:18 +08:00
21 lines
462 B
Go
21 lines
462 B
Go
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Package testutil contains helpers and utilities for writing tests
|
|
package testutil
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// ShouldNotAllocate fails if f allocates.
|
|
func ShouldNotAllocate(t *testing.T, f func()) {
|
|
if Race {
|
|
t.Skip("skip while running with -race")
|
|
return
|
|
}
|
|
if a := testing.AllocsPerRun(10, f); a > 0 {
|
|
t.Errorf("allocations detected: %f", a)
|
|
}
|
|
}
|