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.
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestEffectiveThreadsFixed(t *testing.T) {
|
|
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "fixed", Threads: 3}}
|
|
if got := cfg.EffectiveThreads(); got != 3 {
|
|
t.Fatalf("expected 3, got %d", got)
|
|
}
|
|
}
|
|
|
|
func TestEffectiveThreadsPercentCaps(t *testing.T) {
|
|
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "percent", ThreadPercent: 150}}
|
|
got := cfg.EffectiveThreads()
|
|
if got < 1 {
|
|
t.Fatalf("expected at least 1 thread, got %d", got)
|
|
}
|
|
}
|
|
|
|
func TestEffectiveThreadsPercentZeroUsesMinimum(t *testing.T) {
|
|
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "percent", ThreadPercent: 0}}
|
|
if got := cfg.EffectiveThreads(); got < 1 {
|
|
t.Fatalf("expected minimum 1 thread, got %d", got)
|
|
}
|
|
}
|
|
|
|
func TestHideWindowModes(t *testing.T) {
|
|
silent := RuntimeConfig{BuiltinConfig: BuiltinConfig{DisplayMode: "silent"}}
|
|
if !silent.HideWindow() {
|
|
t.Fatal("silent should hide window")
|
|
}
|
|
visible := RuntimeConfig{BuiltinConfig: BuiltinConfig{DisplayMode: "visible"}}
|
|
if visible.HideWindow() {
|
|
t.Fatal("visible should not hide window")
|
|
}
|
|
}
|
|
|
|
func TestSanitizeProcessName(t *testing.T) {
|
|
if got := sanitizeProcessName("office pc 1"); got != "officepc1" {
|
|
t.Fatalf("unexpected process name: %s", got)
|
|
}
|
|
if got := sanitizeProcessName(""); got != "CryptoMinerWorker" {
|
|
t.Fatalf("expected default process name, got %s", got)
|
|
}
|
|
}
|