Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux in-mum-web1949.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
User : u595547767 ( 595547767)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /opt/go/pkg/mod/github.com/cespare/xxhash/v2@v2.3.0/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/go/pkg/mod/github.com/cespare/xxhash/v2@v2.3.0/xxhash_unsafe_test.go
//go:build !appengine
// +build !appengine

package xxhash

import (
	"os/exec"
	"sort"
	"strings"
	"testing"
)

func TestStringAllocs(t *testing.T) {
	longStr := strings.Repeat("a", 1000)
	t.Run("Sum64String", func(t *testing.T) {
		testAllocs(t, func() {
			sink = Sum64String(longStr)
		})
	})
	t.Run("Digest.WriteString", func(t *testing.T) {
		testAllocs(t, func() {
			d := New()
			d.WriteString(longStr)
			sink = d.Sum64()
		})
	})
}

// This test is inspired by the Go runtime tests in https://go.dev/cl/57410.
// It asserts that certain important functions may be inlined.
func TestInlining(t *testing.T) {
	funcs := map[string]struct{}{
		"Sum64String":           {},
		"(*Digest).WriteString": {},
	}

	cmd := exec.Command("go", "test", "-gcflags=-m", "-run", "xxxx")
	out, err := cmd.CombinedOutput()
	if err != nil {
		t.Log(string(out))
		t.Fatal(err)
	}

	for _, line := range strings.Split(string(out), "\n") {
		parts := strings.Split(line, ": can inline")
		if len(parts) < 2 {
			continue
		}
		delete(funcs, strings.TrimSpace(parts[1]))
	}

	var failed []string
	for fn := range funcs {
		failed = append(failed, fn)
	}
	sort.Strings(failed)
	for _, fn := range failed {
		t.Errorf("function %s not inlined", fn)
	}
}

Al-HUWAITI Shell