xref: /aosp_15_r20/external/emboss/testdata/enum_case.emb (revision 99e0aae7469b87d12f0ad23e61142c2d74c1ef70)
1# Copyright 2023 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15[$default byte_order: "LittleEndian"]
16[(cpp) namespace: "emboss::test"]
17[(cpp) $default enum_case: "kCamelCase"]
18
19enum EnumShouty:
20  [(cpp) $default enum_case: "SHOUTY_CASE"]
21  FIRST                = 0
22  SECOND               = 1
23  TWO_WORD             = 2
24  THREE_WORD_ENUM      = 4
25  LONG_ENUM_VALUE_NAME = 8
26
27enum EnumDefault:
28  FIRST                = 0
29  SECOND               = 1
30  TWO_WORD             = 2
31  THREE_WORD_ENUM      = 4
32  LONG_ENUM_VALUE_NAME = 8
33
34struct UseKCamelEnumCase:
35  0 [+4] EnumDefault v
36  let first = EnumDefault.FIRST
37  let v_is_first = v == EnumDefault.FIRST
38
39enum EnumShoutyAndKCamel:
40  [(cpp) $default enum_case: "SHOUTY_CASE, kCamelCase"]
41  FIRST                = 0
42  SECOND               = 1
43  TWO_WORD             = 2
44  THREE_WORD_ENUM      = 4
45  LONG_ENUM_VALUE_NAME = 8
46
47enum EnumMixed:
48  -- Tests mixing various `enum_case` values in the same enum definition.
49  FIRST                = 0  [(cpp) enum_case: "SHOUTY_CASE, kCamelCase"]
50  SECOND               = 1  [(cpp) enum_case: "SHOUTY_CASE"]
51  TWO_WORD             = 2
52      [(cpp) enum_case: "kCamelCase"]
53  THREE_WORD_ENUM      = 4
54      [(cpp) enum_case: "kCamelCase, SHOUTY_CASE"]
55  LONG_ENUM_VALUE_NAME = 8
56