utils

package
v0.0.0-...-67e014d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitCountUint32

func BitCountUint32(i uint32) uint32

BitCountUint32 Returns the number of one-bits of the specified uint32 value.

func BitCountUint64

func BitCountUint64(i uint64) int

BitCountUint64 Returns the number of one-bits of the specified uint64 value.

func Contain

func Contain[T constraints.Ordered](container []T, target T) bool

Contain returns true if target is the element of container.

func Copy

func Copy[T any](src []T) []T

Copy returns the copy of given slice. Maybe shallow copy depending on the type T, eg: pointer or map

func ElementEqual

func ElementEqual[T comparable](a []T, b []T) bool

ElementEqual 查看两个slice是否元素相同,不区分元素顺序

func EmbeddedSliceEqual

func EmbeddedSliceEqual[T comparable](a [][]T, b [][]T) bool

EmbeddedSliceEqual 判断内嵌的slice是否相同,不区分元素顺序

func InInts

func InInts(nums []int, target int) bool

InInts 查询元素是否在切片中

func Max

func Max[T constraints.Ordered](x, y T) T

Max returns the maximum item of the two inputs

func Min

func Min[T constraints.Ordered](x, y T) T

Min returns the minimum item of the two inputs

func PanicHelper

func PanicHelper(t *testing.T, fn func(), shouldPanic bool)

PanicHelper wraps panic branch

func ShouldNotPanic

func ShouldNotPanic(t *testing.T, fn func())

ShouldNotPanic will report test error if panic

func ShouldPanic

func ShouldPanic(t *testing.T, fn func())

ShouldPanic will report test error if not panic

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL