Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fc9b6e8 authored by Steven Moreland's avatar Steven Moreland
Browse files

Tests for Enum#len

Bug: 117951873
Test: hidl_test
Change-Id: I532c983f72013446869e3c8e3bbc11c776bfcbfa
parent 190473b0
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -147,6 +147,28 @@ interface IExpression {
    logand4 = (0 && 1) == 0,
  };

  // Tests for enum tags
  enum NoElements : uint32_t {};
  enum OneElement : uint32_t {A};
  enum TwoElement : uint32_t {A,B};
  enum TwoCollidingElements : uint32_t {A=1,B=1};
  enum ThreeFromInheritance : TwoElement {C};
  enum ThreeFromDoubleInheritance : ThreeFromInheritance {};
  enum ThreeCollidingFromInheritance : TwoCollidingElements {C};

  enum EnumTagTest : uint32_t {
    a = NoElements#len == 0,
    b = OneElement#len == 1,
    c = TwoElement#len == 2,
    d = TwoCollidingElements#len == 2,
    e = ThreeFromInheritance#len == 3,
    f = ThreeFromDoubleInheritance#len == 3,
    g = ThreeCollidingFromInheritance#len == 3,

    // fine to reference current enum as well
    h = EnumTagTest#len == 8,
  };

  enum Grayscale : int8_t {
    WHITE = 126,
    GRAY, // 127