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/dynamic/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/go/pkg/mod/github.com/cespare/xxhash/v2@v2.3.0/dynamic/plugin.go
//go:build ignore
// +build ignore

package main

import (
	"fmt"
	"log"
	"testing"

	"github.com/cespare/xxhash/v2"
)

const (
	in   = "Call me Ishmael. Some years ago--never mind how long precisely-"
	want = uint64(0x02a2e85470d6fd96)
)

func TestSum(t *testing.T) {
	got := xxhash.Sum64String(in)
	if got != want {
		t.Fatalf("Sum64String: got 0x%x; want 0x%x", got, want)
	}
}

func TestDigest(t *testing.T) {
	for chunkSize := 1; chunkSize <= len(in); chunkSize++ {
		name := fmt.Sprintf("[chunkSize=%d]", chunkSize)
		t.Run(name, func(t *testing.T) {
			d := xxhash.New()
			for i := 0; i < len(in); i += chunkSize {
				chunk := in[i:]
				if len(chunk) > chunkSize {
					chunk = chunk[:chunkSize]
				}
				n, err := d.WriteString(chunk)
				if err != nil || n != len(chunk) {
					t.Fatalf("Digest.WriteString: got (%d, %v); want (%d, nil)",
						n, err, len(chunk))
				}
			}
			if got := d.Sum64(); got != want {
				log.Fatalf("Digest.Sum64: got 0x%x; want 0x%x", got, want)
			}
		})
	}
}

Al-HUWAITI Shell