Source file
src/runtime/lockrank_test.go
1
2
3
4
5 package runtime_test
6
7 import (
8 . "runtime"
9 "testing"
10 )
11
12
13
14 func TestLockRankPartialOrder(t *testing.T) {
15 for r, list := range LockPartialOrder {
16 rank := LockRank(r)
17 for _, e := range list {
18 entry := LockRank(e)
19 if entry > rank {
20 t.Errorf("lockPartialOrder row %v entry %v is inconsistent with total lock ranking order", rank, entry)
21 }
22 }
23 }
24 }
25
26
27
28
29 func TestLockRankPartialOrderSortedEntries(t *testing.T) {
30 for r, list := range LockPartialOrder {
31 rank := LockRank(r)
32 var prev LockRank
33 for _, e := range list {
34 entry := LockRank(e)
35 if entry <= prev {
36 t.Errorf("Partial order for rank %v out of order: %v <= %v in %v", rank, entry, prev, list)
37 }
38 prev = entry
39 }
40 }
41 }
42
View as plain text