File: test_github_issues.cpp

package info (click to toggle)
rapidyaml 0.10.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,676 kB
  • sloc: cpp: 73,851; python: 3,678; javascript: 414; xml: 253; makefile: 96; sh: 44
file content (779 lines) | stat: -rw-r--r-- 25,577 bytes parent folder | download
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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
#include "./test_lib/test_group.hpp"
#include "./test_lib/test_group.def.hpp"

namespace c4 {
namespace yml {

TEST(github, 475_0_space)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
- {a: 1}
# next line has a trailing space
- {b: 2} 
# next line has a trailing space
- [0, {c: 3}] 
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_seq());
    ASSERT_EQ(test.num_children(), 3u);
}

TEST(github, 475_1_space_indented)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
  - {a: 1}
  # next line has a trailing space
  - {b: 2} 
  # next line has a trailing space
  - [0, {c: 3}] 
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_seq());
    ASSERT_EQ(test.num_children(), 3u);
}

TEST(github, 475_2_tab)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
- {a: 1}
# next line has a trailing tab
- {b: 2}	
# next line has a trailing tab
- [0, {c: 3}]	
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_seq());
    ASSERT_EQ(test.num_children(), 3u);
}

TEST(github, 475_3_tab_indented)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
  - {a: 1}
  # next line has a trailing tab
  - {b: 2}	
  # next line has a trailing tab
  - [0, {c: 3}]	
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_seq());
    ASSERT_EQ(test.num_children(), 3u);
}

TEST(github, 475_4_space_map)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
  0: {a: 1}
  # next line has a trailing space
  1: {b: 2} 
  # next line has a trailing space
  2: [0, {c: 3}] 
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_map());
    ASSERT_EQ(test.num_children(), 3u);
}

TEST(github, 475_5_tab_map)
{
    Tree t;
    ExpectError::check_success(&t, [&t]{
        parse_in_arena(R"(
test:
  0: {a: 1}
  # next line has a trailing tab
  1: {b: 2}	
  # next line has a trailing tab
  2: [0, {c: 3}]	
)", &t);
    });
    ConstNodeRef test = t["test"];
    ASSERT_TRUE(test.is_map());
    ASSERT_EQ(test.num_children(), 3u);
}


//-----------------------------------------------------------------------------

TEST(github, 455_0_ok)
{
    Tree t;
    ExpectError::check_success([&t]{
        parse_in_arena(R"(
  processors:
    - simple: a
  sampler:
    trace_id_ratio_based:
      ratio:
)", &t);
    });
    ConstNodeRef sampler = t["sampler"];
    ASSERT_TRUE(sampler.is_map());
    ASSERT_TRUE(sampler.has_child("trace_id_ratio_based"));
    ASSERT_TRUE(sampler["trace_id_ratio_based"].has_child("ratio"));
}

TEST(github, 455_0)
{
    Tree t;
    ExpectError::check_success([&t]{
        parse_in_arena(R"(
  processors:
    - simple:
  sampler:
    trace_id_ratio_based:
      ratio:
)", &t);
    });
    ConstNodeRef sampler = t["sampler"];
    ASSERT_TRUE(sampler.is_map());
    ASSERT_TRUE(sampler.has_child("trace_id_ratio_based"));
    ASSERT_TRUE(sampler["trace_id_ratio_based"].has_child("ratio"));
}

TEST(github, 455_1)
{
    Tree t;
    ExpectError::check_success([&t]{
        parse_in_arena(R"(
file_format: 0.0
tracer_provider:
  processors:
    - simple:
        exporter:
          console:
  sampler:
    trace_id_ratio_based:
      ratio:
    )", &t);
    });
    ConstNodeRef sampler = t["tracer_provider"]["sampler"];
    ASSERT_TRUE(sampler.is_map());
    ASSERT_TRUE(sampler.has_child("trace_id_ratio_based"));
    ASSERT_TRUE(sampler["trace_id_ratio_based"].has_child("ratio"));
}


//-----------------------------------------------------------------------------

TEST(github, 268)
{
    Tree tree = parse_in_arena(R"(
        list:
            - &bar bar
        map:
            node: *bar
    )");
    tree.resolve();
    ConstNodeRef root = tree.crootref();
    ASSERT_TRUE(root["map"].is_map());
    ASSERT_TRUE(root["map"].has_child("node"));
    ASSERT_EQ(root["map"]["node"], "bar");
}

TEST(github, 277)
{
    Tree tree = parse_in_arena(R"(
    A: &A
        V: 3
        W: 4
    B:
        <<: *A
        V: 5
        X: 6
    )");
    const char *keys[] = {"V", "W", "X"};
    const char *vals[] = {"5", "4", "6"};
    #ifdef RYML_DBG
    print_tree("parsed", tree);
    #endif
    test_invariants(tree);
    tree.resolve();
    #ifdef RYML_DBG
    print_tree("resolved", tree);
    #endif
    ConstNodeRef root = tree.crootref();
    ASSERT_TRUE(root["B"].is_map());
    id_type num_childs = root["B"].num_children();
    id_type child = 0;
    ASSERT_EQ(num_childs, 3);
    for (const auto node : root["B"].children())
    {
        EXPECT_EQ(node.key(), csubstr(keys[child], 1));
        EXPECT_EQ(node.val(), csubstr(vals[child], 1));
        child++;
    }
    // test whether the tree is corrupted
    test_invariants(tree);
    child = num_childs;
    for (id_type n = tree.last_child(root["B"].id()); n != NONE; n = tree.prev_sibling(n))
    {
        ASSERT_NE(child, 0);
        EXPECT_EQ(tree.key(n), csubstr(keys[child - 1], 1));
        child--;
    }
}


TEST(github, 78)
{
    Tree t = parse_in_arena("{foo: 1, bar: [2, 3]}");
    EXPECT_EQ(t["foo"].val(), "1");
    EXPECT_EQ(t["bar"][0].val(), "2");
    EXPECT_EQ(t["bar"][1].val(), "3");
}


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

TEST(github, 60)
{
    Tree tree = parse_in_arena(R"(
    traits:
        roleBonuses:
        -   bonus: 5
            bonusText:
                de: Bonus auf die Virusstärke von <a href=showinfo:22177>Relikt-</a>
                    und <a href=showinfo:22175>Datenanalysatoren</a>
                en: bonus to <a href=showinfo:22177>Relic</a> and <a href=showinfo:22175>Data
                    Analyzer</a> virus strength
                fr: de bonus à la puissance du virus des <a href=showinfo:22177>analyseurs
                    de reliques</a> et des <a href=showinfo:22175>analyseurs de données</a>
                ja: <a href=showinfo:22177>遺物アナライザー</a>と<a href=showinfo:22175>データアナライザー</a>のウイルス強度が増加
                ru: повышается степень опасности вирусов, применяемых в <a href=showinfo:22175>комплексах
                    анализа данных</a> и <a href=showinfo:22177>комплексах анализа
                    артефактов</a>
                zh: <a href="showinfo:22177">遗迹分析仪</a>和<a href="showinfo:22175">数据分析仪</a>病毒强度加成
            importance: 1
            unitID: 139
)");
    auto root = tree.rootref();
    ASSERT_TRUE(root.is_map());
    ASSERT_TRUE(root.has_child("traits"));
    auto rb = root["traits"]["roleBonuses"][0];
    ASSERT_FALSE(rb.invalid());
    ASSERT_TRUE(rb.readable());
    EXPECT_EQ(rb["bonus"].val(), "5");
    auto txt = rb["bonusText"];
    ASSERT_TRUE(txt.readable());
    ASSERT_TRUE(txt.is_map());
    EXPECT_TRUE(txt.has_child("de"));
    EXPECT_TRUE(txt.has_child("en"));
    EXPECT_TRUE(txt.has_child("fr"));
    EXPECT_TRUE(txt.has_child("ja"));
    EXPECT_TRUE(txt.has_child("ru"));
    EXPECT_TRUE(txt.has_child("zh"));
    EXPECT_EQ(txt["de"].val(), "Bonus auf die Virusstärke von <a href=showinfo:22177>Relikt-</a> und <a href=showinfo:22175>Datenanalysatoren</a>");
    EXPECT_EQ(txt["en"].val(), "bonus to <a href=showinfo:22177>Relic</a> and <a href=showinfo:22175>Data Analyzer</a> virus strength");
    EXPECT_EQ(txt["fr"].val(), "de bonus à la puissance du virus des <a href=showinfo:22177>analyseurs de reliques</a> et des <a href=showinfo:22175>analyseurs de données</a>");
    EXPECT_EQ(txt["ja"].val(), "<a href=showinfo:22177>遺物アナライザー</a>と<a href=showinfo:22175>データアナライザー</a>のウイルス強度が増加");
    EXPECT_EQ(txt["ru"].val(), "повышается степень опасности вирусов, применяемых в <a href=showinfo:22175>комплексах анализа данных</a> и <a href=showinfo:22177>комплексах анализа артефактов</a>");
    EXPECT_EQ(txt["zh"].val(), "<a href=\"showinfo:22177\">遗迹分析仪</a>和<a href=\"showinfo:22175\">数据分析仪</a>病毒强度加成");


    tree = parse_in_arena(R"(208:
    basePrice: 3000.0
    description:
        de: Ursprünglich als Rakete für den Fangschuss entworfen, um einem beschädigten
            Schiff den Todesstoß zu geben, hat die Inferno Heavy Missile seither eine
            Reihe technischer Upgrades durchlaufen. Die neueste Version hat eine leichtere
            Sprengladung als das Original, aber stark verbesserte Lenksysteme.
        en: Originally designed as a 'finisher' - the killing blow to a crippled ship
            - the Inferno heavy missile has since gone through various technological
            upgrades. The latest version has a lighter payload than the original,
            but much improved guidance systems.
        fr: Conçu à l'origine pour donner le coup de grâce, le missile lourd Inferno
            a depuis subi de nombreuses améliorations techniques. La dernière version
            emporte une charge utile réduite par rapport à l'originale, mais est dotée
            de systèmes de guidage améliorés.
        ja: 元々「フィニッシャー」―大破した船にとどめを刺す兵器として設計されたインフェルノヘビーミサイルは、以来各種の技術改良を経てきた。現行型は初期型より軽い弾頭を採用しているが、それを補って余りある優れた誘導システムを持つ。
        ru: Тяжелая ракета Inferno изначально была спроектирована как «оружие последнего
            удара» для уничтожения подбитых кораблей. С тех пор было выпущено несколько
            ее модификаций. В последней модификации используется заряд меньшей мощности,
            но более совершенная система наведения.
        zh: 炼狱重型导弹历经多种技术改良,原本被设计为给予落魄敌舰最后一击的“终结者”角色。相比原型,最新版导弹载荷较轻,但装配了大幅改进的制导系统。
    graphicID: 20048
    groupID: 385
    iconID: 188
    marketGroupID: 924
    mass: 1000.0
    name:
        de: Inferno Heavy Missile
        en: Inferno Heavy Missile
        fr: Missile lourd Inferno
        ja: インフェルノヘビーミサイル
        ru: Inferno Heavy Missile
        zh: 炼狱重型导弹
    portionSize: 100
    published: true
    radius: 300.0
    volume: 0.03
)");
    root = tree.rootref()["208"];
    EXPECT_EQ(root["description"]["ja"].val(), "元々「フィニッシャー」―大破した船にとどめを刺す兵器として設計されたインフェルノヘビーミサイルは、以来各種の技術改良を経てきた。現行型は初期型より軽い弾頭を採用しているが、それを補って余りある優れた誘導システムを持つ。");
    EXPECT_EQ(root["name"]["ja"].val(), "インフェルノヘビーミサイル");
    EXPECT_EQ(root["name"]["zh"].val(), "炼狱重型导弹");
}


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

TEST(github, 31)
{
    Tree tree;
    NodeRef r = tree.rootref();
    r |= MAP;

    auto meas = r["meas"];
    meas |= MAP;

    auto plist = meas["createParameterList"];
    plist |= SEQ;

    {
        NodeRef lumi = plist.append_child();
        lumi << "Lumi";
        EXPECT_TRUE(lumi.is_val());
    }

    {
        NodeRef lumi = plist.append_child();
        lumi |= MAP;
        lumi["value"] << 1;
        lumi["relErr"] << 0.1;
        EXPECT_TRUE(lumi.is_map());
    }

    {
        ExpectError::check_assertion(&tree, [&](){
            NodeRef lumi = plist.append_child();
            lumi << "Lumi";
            lumi |= MAP;
        });
    }

    {
        ExpectError::check_assertion(&tree, [&](){
            NodeRef lumi = plist.append_child();
            lumi << "Lumi";
            lumi |= SEQ;
        });
    }

    {
        ExpectError::check_assertion(&tree, [&](){
            NodeRef lumi = plist.append_child();
            lumi |= MAP;
            lumi << "Lumi";
        });
    }
}


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

CASE_GROUP(GITHUB_ISSUES)
{

ADD_CASE_TO_GROUP("github3-problem1",
R"(
translation: [-2, -2, 5])",
N(MB, L{N(KP|SFS, "translation", L{N(VP, "-2"), N(VP, "-2"), N(VP, "5")})})
);

// these must work without quotes
ADD_CASE_TO_GROUP("github3-problem2-ex1",
R"(
audio resource:
)",
N(MB, L{N(KP|VN, "audio resource", /*"~"*/{})})
);

ADD_CASE_TO_GROUP("github3-problem2-ex2",
R"(
audio resource:
more:
  example: y
)",
N(MB, L{N(KP|VN, "audio resource", /*"~"*/{}), N(KP|MB, "more", L{N(KP|VP, "example", "y")})})
);

ADD_CASE_TO_GROUP("github3-problem3",
R"(component:
  type: perspective camera component
  some_data: {}  # this was working
  data:
    {}           # but this was not working
)",
N(MB, L{
  N(KP|MB, "component", L{
    N(KP|VP, "type", "perspective camera component"),
    N(KP|MFS, "some_data", L{}),
    N(KP|MFS, "data", L{})
    }
)})
);

/* THIS IS CAUSING VS TO CRASH OUT OF HEAP SPACE
ADD_CASE_TO_GROUP("github3",
R"(
universe:
  objects:
    object:
      uuid: A7AB039C0EF3A74480A1B398247039A7
      components:
        - component:
            type: name component
            data:
              object name: Root Node
        - component:
            type: transform component
            data:
              translation: [-2, -2, 5]
              rotation: [0, 0, 0, 1]
              scaling: [1, 1, 1]
        - component:
            type: perspective camera component
            data:
             {}
        - component:
            type: mesh component
            data:
              mesh resource: TODO
        - component:
            type: lua script component
            data:
             {}
        - component:
            type: audio component
            data:
              audio resource: ''
              type: 0
              current sample: 184102
              spatialized: true
      children:
        - object:
            uuid: E1C364A925D649408E83C8EEF5179A87
            components:
              - component:
                  type: name component
                  data:
                    object name: Prepend
            children:
              []
        - object:
            uuid: 377DBA885AF4CD42B8A56BB3471F60E5
            components:
              - component:
                  type: name component
                  data:
                    object name: pivot
            children:
              []
        - object:
            uuid: 6DD1835797DADB4F95232CE7E9DE41BA
            components:
              - component:
                  type: name component
                  data:
                    object name: Append
            children:
              []
)",
  L{N("universe", L{
        N("objects", L{
            N("object", L{
                N("uuid", "A7AB039C0EF3A74480A1B398247039A7"),
                N("components", L{
                    N(L{N("component", L{N("type", "name component"), N("data", L{N("object name", "Root Node")}), }), }),
                    N(L{N("component", L{N("type", "transform component"), N("data", L{N("translation", L{N("-2"), N("-2"), N("5")}), N("rotation", L{N("0"), N("0"), N("0"), N("1")}), N("scaling", L{N("1"), N("1"), N("1")}),}), }), }),
                    N(L{N("component", L{N("type", "perspective camera component"), N(KEYMAP, "data", L{}), }), }),
                    N(L{N("component", L{N("type", "mesh component"), N("data", L{N("mesh resource", "TODO")}), }), }),
                    N(L{N("component", L{N("type", "lua script component"), N(KEYMAP, "data", L{}), }), }),
                    N(L{N("component", L{N("type", "audio component"), N("data", L{N("audio resource", ""), N("type", "0"), N("current sample", "184102"), N("spatialized", "true"), }), }), }), // component
                  }), // components
                N("children", L{
                    N(L{N("object", L{
                        N("uuid", "E1C364A925D649408E83C8EEF5179A87"),
                        N("components", L{N(L{N("component", L{N("type", "name component"), N("data", L{N("object name", "Prepend")}), }), }), }),
                        N(KEYSEQ, "children", L{}),
                    }), }), // object
                    N(L{N("object", L{
                        N("uuid", "377DBA885AF4CD42B8A56BB3471F60E5"),
                        N("components", L{N(L{N("component", L{N("type", "name component"), N("data", L{N("object name", "pivot")}), }), }), }),
                        N(KEYSEQ, "children", L{}),
                    }), }), // object
                    N(L{N("object", L{
                        N("uuid", "6DD1835797DADB4F95232CE7E9DE41BA"),
                        N("components", L{N(L{N("component", L{N("type", "name component"), N("data", L{N("object name", "Append")}), }), }), }),
                        N(KEYSEQ, "children", L{}),
                    }), }), // object
                  }), // children
                }), // object
              }) // objects
          }) // universe
      }
);
*/

ADD_CASE_TO_GROUP("github6-problem1",
R"(
- UQxRibHKEDI:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
- DcYsg8VFdC0:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
- Yt3ymqZXzLY:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
)",
N(SB, L{
N(MB, L{N(KP|SB, "UQxRibHKEDI", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
N(MB, L{N(KP|SB, "DcYsg8VFdC0", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
N(MB, L{N(KP|SB, "Yt3ymqZXzLY", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
})
);

ADD_CASE_TO_GROUP("github6",
R"(videos:
- UQxRibHKEDI:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
- DcYsg8VFdC0:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
- Yt3ymqZXzLY:
  - 0.mp4
  - 1.mp4
  - 2.mp4
  - 3.mp4
)",
N(MB, L{
  N(KP|SB, "videos", L{
    N(MB, L{N(KP|SB, "UQxRibHKEDI", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
    N(MB, L{N(KP|SB, "DcYsg8VFdC0", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
    N(MB, L{N(KP|SB, "Yt3ymqZXzLY", L{N(VP,"0.mp4"), N(VP,"1.mp4"), N(VP,"2.mp4"), N(VP,"3.mp4")})}),
  })
})
);

ADD_CASE_TO_GROUP("github34/ex1",
R"(
# correct:
MessageID1: 'MapRegion_HyrulePrairie'
MessageID2: "MapRegion_HyrulePrairie"
MessageID3: 'MapRegion_HyrulePrairie'
MessageID4: "MapRegion_HyrulePrairie"
# incorrect: uninitialised memory?
MessageID5:  'MapRegion_HyrulePrairie'
MessageID6:  "MapRegion_HyrulePrairie"
MessageID7:   'MapRegion_HyrulePrairie'
MessageID8:   "MapRegion_HyrulePrairie"
MessageID9:          'MapRegion_HyrulePrairie'
MessageID0:          "MapRegion_HyrulePrairie"
)",
N(MB, L{
  N(KP|VS, "MessageID1", "MapRegion_HyrulePrairie"),
  N(KP|VD, "MessageID2", "MapRegion_HyrulePrairie"),
  N(KP|VS, "MessageID3", "MapRegion_HyrulePrairie"),
  N(KP|VD, "MessageID4", "MapRegion_HyrulePrairie"),
  N(KP|VS, "MessageID5", "MapRegion_HyrulePrairie"),
  N(KP|VD, "MessageID6", "MapRegion_HyrulePrairie"),
  N(KP|VS, "MessageID7", "MapRegion_HyrulePrairie"),
  N(KP|VD, "MessageID8", "MapRegion_HyrulePrairie"),
  N(KP|VS, "MessageID9", "MapRegion_HyrulePrairie"),
  N(KP|VD, "MessageID0", "MapRegion_HyrulePrairie"),
})
);

ADD_CASE_TO_GROUP("github34/ex2",
R"(
# correct:
- MessageID1: 'MapRegion_HyrulePrairie'
- MessageID2: "MapRegion_HyrulePrairie"
-  MessageID3: 'MapRegion_HyrulePrairie'
-  MessageID4: "MapRegion_HyrulePrairie"
# incorrect: uninitialised memory?
- MessageID5:  'MapRegion_HyrulePrairie'
- MessageID6:  "MapRegion_HyrulePrairie"
- MessageID7:   'MapRegion_HyrulePrairie'
- MessageID8:   "MapRegion_HyrulePrairie"
-  MessageID9:          'MapRegion_HyrulePrairie'
-  MessageID0:          "MapRegion_HyrulePrairie"
)",
N(SB, L{
  N(MB, L{N(KP|VS, "MessageID1", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID2", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VS, "MessageID3", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID4", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VS, "MessageID5", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID6", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VS, "MessageID7", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID8", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VS, "MessageID9", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID0", "MapRegion_HyrulePrairie")}),
})
);

ADD_CASE_TO_GROUP("github34",
R"(
# incorrect: uninitialised memory?
-  MessageID1:          'MapRegion_HyrulePrairie'
-  MessageID2:          "MapRegion_HyrulePrairie"

# incorrect: uninitialised memory?
-  MessageID3:          'MapRegion_HyrulePrairie '
-  MessageID4:          "MapRegion_HyrulePrairie "

# incorrect: for some reason the ' is included in the string
-  MessageID5: 'MapRegion_HyrulePrairie '
- MessageID6: 'MapRegion_HyrulePrairie '
-  MessageID7: "MapRegion_HyrulePrairie "
- MessageID8: "MapRegion_HyrulePrairie "

# incorrect: same issue
- MessageID9: 'MapRegion_HyrulePrairie '
- MessageID10: "MapRegion_HyrulePrairie "

# incorrect: still has the trailing quote
- MessageID11: 'MapRegion_HyrulePrairie'
- MessageID12: "MapRegion_HyrulePrairie"

# the string is parsed correctly in this case
- key1: true1
  MessageID1:          'MapRegion_HyrulePrairie1 '
- key2: true2
  MessageID2:          "MapRegion_HyrulePrairie2 "
)",
N(SB, L{
  N(MB, L{N(KP|VS, "MessageID1",  "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID2",  "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VS, "MessageID3",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VD, "MessageID4",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VS, "MessageID5",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VS, "MessageID6",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VD, "MessageID7",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VD, "MessageID8",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VS, "MessageID9",  "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VD, "MessageID10", "MapRegion_HyrulePrairie ")}),
  N(MB, L{N(KP|VS, "MessageID11", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VD, "MessageID12", "MapRegion_HyrulePrairie")}),
  N(MB, L{N(KP|VP, "key1", "true1"), N(KP|VS, "MessageID1", "MapRegion_HyrulePrairie1 ")}),
  N(MB, L{N(KP|VP, "key2", "true2"), N(KP|VD, "MessageID2", "MapRegion_HyrulePrairie2 ")}),
})
);

ADD_CASE_TO_GROUP("github35/expected_error11", EXPECT_PARSE_ERROR,
R"(
# *segfault* // not anymore!
- key1: true1
 MessageID1:          'MapRegion_HyrulePrairie1 '
)",
  LineCol(4, 1)
);

ADD_CASE_TO_GROUP("github35/expected_error12", EXPECT_PARSE_ERROR,
R"(
# *segfault* // not anymore!
- key2: true2
 MessageID2:          "MapRegion_HyrulePrairie2 "
)",
  LineCol(4, 1)
);

ADD_CASE_TO_GROUP("github35/expected_error21", EXPECT_PARSE_ERROR,
R"(
# *segfault* // not anymore!
- key1: true1
    MessageID1:          'MapRegion_HyrulePrairie1 '
)",
  LineCol(4, 15)
);

ADD_CASE_TO_GROUP("github35/expected_error22", EXPECT_PARSE_ERROR,
R"(
# *segfault* // not anymore!
- key2: true2
    MessageID2:          "MapRegion_HyrulePrairie2 "
)",
  LineCol(4, 15)
);

ADD_CASE_TO_GROUP("github128/1", RESOLVE_REFS | EXPECT_RESOLVE_ERROR, "a: *invalid");
ADD_CASE_TO_GROUP("github128/2", RESOLVE_REFS | EXPECT_RESOLVE_ERROR, "*");
ADD_CASE_TO_GROUP("github128/3", RESOLVE_REFS | EXPECT_RESOLVE_ERROR, "*abc");
ADD_CASE_TO_GROUP("github128/4", "*abc", N(VAL, "*abc", AR(VALREF, "*abc")));

ADD_CASE_TO_GROUP("github129", RESOLVE_REFS, R"(
ref: &ref ref_val
a: *ref   # resolve the reference
b: '*ref' # don't resolve, it's just a string
c: "*ref" # don't resolve, it's just a string
d: >      # don't resolve, it's just a string
  *ref
e: >-     # don't resolve, it's just a string
  *ref
f: >+     # don't resolve, it's just a string
  *ref
g: |      # don't resolve, it's just a string
  *ref
h: |-     # don't resolve, it's just a string
  *ref
i: |+     # don't resolve, it's just a string
  *ref
)",
N(MB, L{
  N(KP|VP, "ref", "ref_val"),
  N(KP|VP, "a", "ref_val"),    // this should be resolved
  N(KP|VS, "b", "*ref"),   // this should not be resolved (just a string)
  N(KP|VD, "c", "*ref"),   // this should not be resolved (just a string)
  N(KP|VF, "d", "*ref\n"), // this should not be resolved (just a string)
  N(KP|VF, "e", "*ref"),   // this should not be resolved (just a string)
  N(KP|VF, "f", "*ref\n"), // this should not be resolved (just a string)
  N(KP|VL, "g", "*ref\n"), // this should not be resolved (just a string)
  N(KP|VL, "h", "*ref"),   // this should not be resolved (just a string)
  N(KP|VL, "i", "*ref\n"),   // this should not be resolved (just a string)
})
);

}

} // namespace yml
} // namespace c4