Fix test on Windows (with 1 CPU)

This commit is contained in:
Matthew Holt 2016-06-21 00:23:18 -06:00
parent e625c7c051
commit 0a3f68f0d7
No known key found for this signature in database
GPG key ID: 0D97CC73664F4D03

View file

@ -6,8 +6,9 @@ import (
)
func TestNumProcs(t *testing.T) {
num := runtime.NumCPU()
n := numProcs()
if n != runtime.NumCPU()-1 {
t.Errorf("Expected numProcs to return NumCPU-1, got %d", n)
if num > 1 && n != num-1 {
t.Errorf("Expected numProcs to return max(NumCPU-1, 0) but got %d (NumCPU=%d)", n, num)
}
}