aboutsummaryrefslogtreecommitdiff
path: root/test/opt/set_spec_const_default_value_test.cpp
blob: a6eaab9ec6d67bbe9dd95f301462c8a177f01d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
// Copyright (c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "pass_fixture.h"

#include <gmock/gmock.h>

namespace {
using namespace spvtools;

using testing::Eq;

using SpecIdToValueStrMap =
    opt::SetSpecConstantDefaultValuePass::SpecIdToValueStrMap;

struct DefaultValuesStringParsingTestCase {
  const char* default_values_str;
  bool expect_success;
  SpecIdToValueStrMap expected_map;
};

using DefaultValuesStringParsingTest =
    ::testing::TestWithParam<DefaultValuesStringParsingTestCase>;

TEST_P(DefaultValuesStringParsingTest, TestCase) {
  const auto& tc = GetParam();
  auto actual_map =
      opt::SetSpecConstantDefaultValuePass::ParseDefaultValuesString(
          tc.default_values_str);
  if (tc.expect_success) {
    EXPECT_NE(nullptr, actual_map);
    if (actual_map) EXPECT_THAT(*actual_map, Eq(tc.expected_map));
  } else {
    EXPECT_EQ(nullptr, actual_map);
  }
}

INSTANTIATE_TEST_CASE_P(
    ValidString, DefaultValuesStringParsingTest,
    ::testing::ValuesIn(std::vector<DefaultValuesStringParsingTestCase>{
        // 0. empty map
        {"", true, SpecIdToValueStrMap{}},
        // 1. one pair
        {"100:1024", true, SpecIdToValueStrMap{{100, "1024"}}},
        // 2. two pairs
        {"100:1024 200:2048", true,
         SpecIdToValueStrMap{{100, "1024"}, {200, "2048"}}},
        // 3. spaces between entries
        {"100:1024 \n \r \t \v \f 200:2048", true,
         SpecIdToValueStrMap{{100, "1024"}, {200, "2048"}}},
        // 4. \t, \n, \r and spaces before spec id
        {"   \n \r\t \t \v \f 100:1024", true,
         SpecIdToValueStrMap{{100, "1024"}}},
        // 5. \t, \n, \r and spaces after value string
        {"100:1024   \n \r\t \t \v \f ", true,
         SpecIdToValueStrMap{{100, "1024"}}},
        // 6. maximum spec id
        {"4294967295:0", true, SpecIdToValueStrMap{{4294967295, "0"}}},
        // 7. minimum spec id
        {"0:100", true, SpecIdToValueStrMap{{0, "100"}}},
        // 8. random content without spaces are allowed
        {"200:random_stuff", true, SpecIdToValueStrMap{{200, "random_stuff"}}},
        // 9. support hex format spec id (just because we use the
        // ParseNumber() utility)
        {"0x100:1024", true, SpecIdToValueStrMap{{256, "1024"}}},
        // 10. multiple entries
        {"101:1 102:2 103:3 104:4 200:201 9999:1000 0x100:333", true,
         SpecIdToValueStrMap{{101, "1"},
                             {102, "2"},
                             {103, "3"},
                             {104, "4"},
                             {200, "201"},
                             {9999, "1000"},
                             {256, "333"}}},
        // 11. default value in hex float format
        {"100:0x0.3p10", true, SpecIdToValueStrMap{{100, "0x0.3p10"}}},
        // 12. default value in decimal float format
        {"100:1.5e-13", true, SpecIdToValueStrMap{{100, "1.5e-13"}}},
    }));

INSTANTIATE_TEST_CASE_P(
    InvalidString, DefaultValuesStringParsingTest,
    ::testing::ValuesIn(std::vector<DefaultValuesStringParsingTestCase>{
        // 0. missing default value
        {"100:", false, SpecIdToValueStrMap{}},
        // 1. spec id is not an integer
        {"100.0:200", false, SpecIdToValueStrMap{}},
        // 2. spec id is not a number
        {"something_not_a_number:1", false, SpecIdToValueStrMap{}},
        // 3. only spec id number
        {"100", false, SpecIdToValueStrMap{}},
        // 4. same spec id defined multiple times
        {"100:20 100:21", false, SpecIdToValueStrMap{}},
        // 5. Multiple definition of an identical spec id in different forms
        // is not allowed
        {"0x100:100 256:200", false, SpecIdToValueStrMap{}},
        // 6. empty spec id
        {":3", false, SpecIdToValueStrMap{}},
        // 7. only colon
        {":", false, SpecIdToValueStrMap{}},
        // 8. spec id overflow
        {"4294967296:200", false, SpecIdToValueStrMap{}},
        // 9. spec id less than 0
        {"-1:200", false, SpecIdToValueStrMap{}},
        // 10. nullptr
        {nullptr, false, SpecIdToValueStrMap{}},
        // 11. only a number is invalid
        {"1234", false, SpecIdToValueStrMap{}},
        // 12. invalid entry separator
        {"12:34;23:14", false, SpecIdToValueStrMap{}},
        // 13. invalid spec id and default value separator
        {"12@34", false, SpecIdToValueStrMap{}},
        // 14. spaces before colon
        {"100   :1024", false, SpecIdToValueStrMap{}},
        // 15. spaces after colon
        {"100:   1024", false, SpecIdToValueStrMap{}},
        // 16. spec id represented in hex float format is invalid
        {"0x3p10:200", false, SpecIdToValueStrMap{}},
    }));

struct SetSpecConstantDefaultValueTestCase {
  const char* code;
  SpecIdToValueStrMap default_values;
  const char* expected;
};

using SetSpecConstantDefaultValueParamTest =
    PassTest<::testing::TestWithParam<SetSpecConstantDefaultValueTestCase>>;

TEST_P(SetSpecConstantDefaultValueParamTest, TestCase) {
  const auto& tc = GetParam();
  SinglePassRunAndCheck<opt::SetSpecConstantDefaultValuePass>(
      tc.code, tc.expected, /* skip_nop = */ false, tc.default_values);
}

INSTANTIATE_TEST_CASE_P(
    ValidCases, SetSpecConstantDefaultValueParamTest,
    ::testing::ValuesIn(std::vector<SetSpecConstantDefaultValueTestCase>{
        // 0. Empty.
        {"", SpecIdToValueStrMap{}, ""},
        // 1. Empty with non-empty values to set.
        {"", SpecIdToValueStrMap{{1, "100"}, {2, "200"}}, ""},
        // 2. Bool type.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%bool = OpTypeBool\n"
            "%1 = OpSpecConstantTrue %bool\n"
            "%2 = OpSpecConstantFalse %bool\n",
            // default values
            SpecIdToValueStrMap{{100, "false"}, {101, "true"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%bool = OpTypeBool\n"
            "%1 = OpSpecConstantFalse %bool\n"
            "%2 = OpSpecConstantTrue %bool\n",
        },
        // 3. 32-bit int type.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "OpDecorate %3 SpecId 102\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int 10\n"
            "%2 = OpSpecConstant %int 11\n"
            "%3 = OpSpecConstant %int 11\n",
            // default values
            SpecIdToValueStrMap{
                {100, "2147483647"}, {101, "0xffffffff"}, {102, "-42"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "OpDecorate %3 SpecId 102\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int 2147483647\n"
            "%2 = OpSpecConstant %int -1\n"
            "%3 = OpSpecConstant %int -42\n",
        },
        // 4. 64-bit uint type.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%ulong = OpTypeInt 64 0\n"
            "%1 = OpSpecConstant %ulong 10\n"
            "%2 = OpSpecConstant %ulong 11\n",
            // default values
            SpecIdToValueStrMap{{100, "18446744073709551614"}, {101, "0x100"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%ulong = OpTypeInt 64 0\n"
            "%1 = OpSpecConstant %ulong 18446744073709551614\n"
            "%2 = OpSpecConstant %ulong 256\n",
        },
        // 5. 32-bit float type.
        {
            // code
            "OpDecorate %1 SpecId 101\n"
            "OpDecorate %2 SpecId 102\n"
            "%float = OpTypeFloat 32\n"
            "%1 = OpSpecConstant %float 200\n"
            "%2 = OpSpecConstant %float 201\n",
            // default values
            SpecIdToValueStrMap{{101, "-0x1.fffffep+128"}, {102, "2.5"}},
            // expected
            "OpDecorate %1 SpecId 101\n"
            "OpDecorate %2 SpecId 102\n"
            "%float = OpTypeFloat 32\n"
            "%1 = OpSpecConstant %float -0x1.fffffep+128\n"
            "%2 = OpSpecConstant %float 2.5\n",
        },
        // 6. 64-bit float type.
        {
            // code
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 3.14159265358979\n"
            "%2 = OpSpecConstant %double 0.142857\n",
            // default values
            SpecIdToValueStrMap{{201, "0x1.fffffffffffffp+1024"},
                                {202, "-32.5"}},
            // expected
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n"
            "%2 = OpSpecConstant %double -32.5\n",
        },
        // 7. SpecId not found, expect no modification.
        {
            // code
            "OpDecorate %1 SpecId 201\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 3.14159265358979\n",
            // default values
            SpecIdToValueStrMap{{8888, "0.0"}},
            // expected
            "OpDecorate %1 SpecId 201\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 3.14159265358979\n",
        },
        // 8. Multiple types of spec constants.
        {
            // code
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "OpDecorate %3 SpecId 203\n"
            "%bool = OpTypeBool\n"
            "%int = OpTypeInt 32 1\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 3.14159265358979\n"
            "%2 = OpSpecConstant %int 1024\n"
            "%3 = OpSpecConstantTrue %bool\n",
            // default values
            SpecIdToValueStrMap{
                {201, "0x1.fffffffffffffp+1024"}, {202, "2048"}, {203, "false"},
            },
            // expected
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "OpDecorate %3 SpecId 203\n"
            "%bool = OpTypeBool\n"
            "%int = OpTypeInt 32 1\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n"
            "%2 = OpSpecConstant %int 2048\n"
            "%3 = OpSpecConstantFalse %bool\n",
        },
        // 9. Ignore other decorations.
        {
            // code
            "OpDecorate %1 ArrayStride 4\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{4, "0x7fffffff"}},
            // expected
            "OpDecorate %1 ArrayStride 4\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int 100\n",
        },
        // 10. Distinguish from other decorations.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %1 ArrayStride 4\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{4, "0x7fffffff"}, {100, "0xffffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %1 ArrayStride 4\n"
            "%int = OpTypeInt 32 1\n"
            "%1 = OpSpecConstant %int -1\n",
        },
        // 11. Decorate through decoration group.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 2147483647\n",
        },
        // 12. Ignore other decorations in decoration group.
        {
            // code
            "OpDecorate %1 ArrayStride 4\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{4, "0x7fffffff"}},
            // expected
            "OpDecorate %1 ArrayStride 4\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n",
        },
        // 13. Distinguish from other decorations in decoration group.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %1 ArrayStride 4\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}, {4, "0x00000001"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %1 ArrayStride 4\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 2147483647\n",
        },
        // 14. Unchanged bool default value
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%bool = OpTypeBool\n"
            "%1 = OpSpecConstantTrue %bool\n"
            "%2 = OpSpecConstantFalse %bool\n",
            // default values
            SpecIdToValueStrMap{{100, "true"}, {101, "false"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%bool = OpTypeBool\n"
            "%1 = OpSpecConstantTrue %bool\n"
            "%2 = OpSpecConstantFalse %bool\n",
        },
        // 15. Unchanged int default values
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%int = OpTypeInt 32 1\n"
            "%ulong = OpTypeInt 64 0\n"
            "%1 = OpSpecConstant %int 10\n"
            "%2 = OpSpecConstant %ulong 11\n",
            // default values
            SpecIdToValueStrMap{{100, "10"}, {101, "11"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "OpDecorate %2 SpecId 101\n"
            "%int = OpTypeInt 32 1\n"
            "%ulong = OpTypeInt 64 0\n"
            "%1 = OpSpecConstant %int 10\n"
            "%2 = OpSpecConstant %ulong 11\n",
        },
        // 16. Unchanged float default values
        {
            // code
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "%float = OpTypeFloat 32\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %float 3.14159\n"
            "%2 = OpSpecConstant %double 0.142857\n",
            // default values
            SpecIdToValueStrMap{{201, "3.14159"}, {202, "0.142857"}},
            // expected
            "OpDecorate %1 SpecId 201\n"
            "OpDecorate %2 SpecId 202\n"
            "%float = OpTypeFloat 32\n"
            "%double = OpTypeFloat 64\n"
            "%1 = OpSpecConstant %float 3.14159\n"
            "%2 = OpSpecConstant %double 0.142857\n",
        },
        // 17. OpGroupDecorate may have multiple target ids defined by the same
        // eligible spec constant
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2 %2 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{100, "0xffffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2 %2 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int -1\n",
        },
    }));

INSTANTIATE_TEST_CASE_P(
    InvalidCases, SetSpecConstantDefaultValueParamTest,
    ::testing::ValuesIn(std::vector<SetSpecConstantDefaultValueTestCase>{
        // 0. Do not crash when decoration group is not used.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "%int = OpTypeInt 32 1\n"
            "%3 = OpSpecConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "%int = OpTypeInt 32 1\n"
            "%3 = OpSpecConstant %int 100\n",
        },
        // 1. Do not crash when target does not exist.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n",
        },
        // 2. Do nothing when SpecId decoration is not attached to a
        // non-spec-contant instruction.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n"
            "%int_101 = OpConstant %int 101\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n"
            "%int_101 = OpConstant %int 101\n",
        },
        // 3. Do nothing when SpecId decoration is not attached to a
        // OpSpecConstant{|True|False} instruction.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n"
            "%3 = OpSpecConstant %int 101\n"
            "%1 = OpSpecConstantOp %int IAdd %3 %3\n",
            // default values
            SpecIdToValueStrMap{{100, "0x7fffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%int = OpTypeInt 32 1\n"
            "%3 = OpSpecConstant %int 101\n"
            "%1 = OpSpecConstantOp %int IAdd %3 %3\n",
        },
        // 4. Do not crash and do nothing when SpecId decoration is applied to
        // multiple spec constants.
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2 %3 %4\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n"
            "%3 = OpSpecConstant %int 200\n"
            "%4 = OpSpecConstant %int 300\n",
            // default values
            SpecIdToValueStrMap{{100, "0xffffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2 %3 %4\n"
            "%int = OpTypeInt 32 1\n"
            "%2 = OpSpecConstant %int 100\n"
            "%3 = OpSpecConstant %int 200\n"
            "%4 = OpSpecConstant %int 300\n",
        },
        // 5. Do not crash and do nothing when SpecId decoration is attached to
        // non-spec-constants (invalid case).
        {
            // code
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%int_100 = OpConstant %int 100\n",
            // default values
            SpecIdToValueStrMap{{100, "0xffffffff"}},
            // expected
            "OpDecorate %1 SpecId 100\n"
            "%1 = OpDecorationGroup\n"
            "OpGroupDecorate %1 %2\n"
            "%int = OpTypeInt 32 1\n"
            "%int_100 = OpConstant %int 100\n",
        },
    }));

}  // anonymous namespace