Skip to content

Commit

Permalink
core: update SetNumThreads test to display results in case of error
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jan 4, 2023
1 parent c8c33ba commit 3d1f14f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3046,22 +3046,22 @@ func TestElemSize(t *testing.T) {
}

func TestSetThreadNumber(t *testing.T) {
N := GetNumThreads()
original := GetNumThreads()

SetNumThreads(-1)
if GetNumThreads() != N {
t.Error("incorrect thread number")
if num := GetNumThreads(); num != original {
t.Errorf("incorrect number of threads, got %d, want %d", num, original)
}

SetNumThreads(0)
if GetNumThreads() != N {
t.Error("incorrect thread number")
if num := GetNumThreads(); num < 1 {
t.Errorf("incorrect number of threads, got %d, want at least 1", num)
}

SetNumThreads(1)
if GetNumThreads() != 1 {
t.Error("incorrect thread number")
if num := GetNumThreads(); num != 1 {
t.Errorf("incorrect number of threads, got %d, want %d", num, 1)
}

SetNumThreads(N)
SetNumThreads(original)
}

0 comments on commit 3d1f14f

Please sign in to comment.