libbacktrace: use __has_attribute for fallthrough
[official-gcc.git] / libgo / go / runtime / lockrank_test.go
blob4b2fc0eaeeaa67cb3a3ec1285032609bfce518cb
1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package runtime_test
7 import (
8 . "runtime"
9 "testing"
12 // Check that the partial order in lockPartialOrder fits within the total order
13 // determined by the order of the lockRank constants.
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)
26 // Verify that partial order lists are kept sorted. This is a purely cosemetic
27 // check to make manual reviews simpler. It does not affect correctness, unlike
28 // the above test.
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)
38 prev = entry