Home | History | Annotate | Download | only in tests
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Don't warn for unscoped enums (for now).
      6 enum UnscopedEnumIgnored {
      7   kMaxValue = -1,
      8   kOops = 0,
      9 };
     10 
     11 // Warn if kMaxValue doesn't have the highest enumerator value.
     12 enum class NotHighest {
     13   kNegative = -1,
     14   kZero = 0,
     15   kMaxValue = kNegative,
     16 };
     17 
     18 // Also warn if kMaxValue has a unique value: it should share the highest value
     19 // to avoid polluting switch statements.
     20 enum class MaxValueIsUnique {
     21   kNegative = -1,
     22   kZero = 0,
     23   kMaxValue,
     24 };
     25 
     26 // No warning if everything is right.
     27 enum class CorrectMaxValue {
     28   kNegative = -1,
     29   kZero = 0,
     30   kMaxValue = kZero,
     31 };
     32 
     33 // No warning if the enum does not contain kMaxValue.
     34 enum class NoMaxValue {
     35   kNegative = -1,
     36   kZero = 0,
     37   kNotMaxValue = 1,
     38 };
     39