Files
AetherForge/agent/miner/target_test.go
drjones f7d6dcf542 Upgrade dashboard, builder, and agent resource controls.
Dark UI with hashrate graphs, inline setting help, percent-based threads/RAM, configurable process name and display modes, and LAN-aware run.bat startup banner.
2026-05-26 23:26:39 -07:00

29 lines
785 B
Go

package miner
import (
"testing"
)
func TestHashMeetsTargetEqual(t *testing.T) {
target := "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
hash := "0000000000000000000000000000000000000000000000000000000000000001"
if !hashMeetsTarget(hash, target) {
t.Fatal("lower hash should meet high target")
}
}
func TestHashMeetsTargetReject(t *testing.T) {
target := "0000000000000000000000000000000000000000000000000000000000000001"
hash := "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
if hashMeetsTarget(hash, target) {
t.Fatal("high hash should not meet low target")
}
}
func TestDifficultyToTargetHex(t *testing.T) {
out := difficultyToTargetHex(1000)
if len(out) != 64 {
t.Fatalf("expected 64 hex chars, got %d", len(out))
}
}