package syscheck import ( "context" "testing" ) func TestGetMemorySpace(t *testing.T) { size, err := GetMemorySpace(context.Background()) if err != nil { t.Fatalf("Failed to get memory space: %v", err) } if size <= 0 { t.Errorf("expected memory space to be greater than 0, got %d", size) } t.Logf("Total physical memory: %d bytes (%.2f GB)", size, float64(size)/(1024*1024*1024)) } func TestGetMemorySpeed(t *testing.T) { // Test memory speed (may take a few seconds) // Skip in short mode if testing.Short() { t.Skip("Skipping memory speed test in short mode") } rs, ws, err := GetMemorySpeed(context.Background()) if err != nil { t.Fatalf("Failed to get memory speed: %v", err) } if rs <= 0 { t.Errorf("expected read speed > 0, got %d", rs) } if ws <= 0 { t.Errorf("expected write speed > 0, got %d", ws) } t.Logf("Memory read speed: %d bytes/s (%.2f GB/s)", rs, float64(rs)/(1024*1024*1024)) t.Logf("Memory write speed: %d bytes/s (%.2f GB/s)", ws, float64(ws)/(1024*1024*1024)) }