bytesconv_test.go — gin Source File
Architecture documentation for bytesconv_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 69530ef4_f5f3_deb3_9a65_117780f0140b["bytesconv_test.go"] fefe783b_8987_7aed_66c9_b2860bfc32e7["bytes"] 69530ef4_f5f3_deb3_9a65_117780f0140b --> fefe783b_8987_7aed_66c9_b2860bfc32e7 style 69530ef4_f5f3_deb3_9a65_117780f0140b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Copyright 2020 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package bytesconv
import (
"bytes"
cRand "crypto/rand"
"math/rand"
"strings"
"testing"
"time"
)
var (
testString = "Albert Einstein: Logic will get you from A to B. Imagination will take you everywhere."
testBytes = []byte(testString)
)
func rawBytesToStr(b []byte) string {
return string(b)
}
func rawStrToBytes(s string) []byte {
return []byte(s)
}
// go test -v
func TestBytesToString(t *testing.T) {
data := make([]byte, 1024)
for range 100 {
_, err := cRand.Read(data)
if err != nil {
t.Fatal(err)
}
if rawBytesToStr(data) != BytesToString(data) {
t.Fatal("don't match")
}
}
}
func TestBytesToStringEmpty(t *testing.T) {
if got := BytesToString([]byte{}); got != "" {
t.Fatalf("BytesToString([]byte{}) = %q; want empty string", got)
}
if got := BytesToString(nil); got != "" {
t.Fatalf("BytesToString(nil) = %q; want empty string", got)
}
}
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
const (
letterIdxBits = 6 // 6 bits to represent a letter index
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
)
var src = rand.New(rand.NewSource(time.Now().UnixNano()))
// ... (65 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- bytes
Source
Frequently Asked Questions
What does bytesconv_test.go do?
bytesconv_test.go is a source file in the gin codebase, written in go. It belongs to the InternalUtilities domain, MemoryOptimization subdomain.
What functions are defined in bytesconv_test.go?
bytesconv_test.go defines 11 function(s): BenchmarkBytesConvBytesToStr, BenchmarkBytesConvBytesToStrRaw, BenchmarkBytesConvStrToBytes, BenchmarkBytesConvStrToBytesRaw, RandStringBytesMaskImprSrcSB, TestBytesToString, TestBytesToStringEmpty, TestStringToBytes, TestStringToBytesEmpty, rawBytesToStr, and 1 more.
What does bytesconv_test.go depend on?
bytesconv_test.go imports 1 module(s): bytes.
Where is bytesconv_test.go in the architecture?
bytesconv_test.go is located at internal/bytesconv/bytesconv_test.go (domain: InternalUtilities, subdomain: MemoryOptimization, directory: internal/bytesconv).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free