• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Shenzhen Kaihong Digital.
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  * http://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 
16 package gen;
17 
18 import grammar.*;
19 import org.junit.jupiter.api.Test;
20 
21 import java.io.File;
22 import java.util.List;
23 import java.util.concurrent.CopyOnWriteArrayList;
24 
25 import static org.junit.jupiter.api.Assertions.assertEquals;
26 import static utils.FileUtils.readText;
27 
28 /**
29  * <h3>类名:该类用于xxx</h3>
30  * description
31  *
32  * @author Administrator
33  *         date 2025-02-28
34  * @version 1.0
35  * @since 2025-02-28
36  */
37 class GenCHFileTest2 {
38     private String genUnionContentTest = "\nstruct TestStruct {\n" +
39             "\tchar* name;\n" +
40             "\tint age;\n" +
41             "\tlong p1;\n" +
42             "\tshort p2;\n" +
43             "\tlong long p3;\n" +
44             "\tfloat p4;\n" +
45             "\tdouble p5;\n" +
46             "\tuint8 p6;\n" +
47             "\tuint16 p7;\n" +
48             "\tuint32 p8;\n" +
49             "\tuint64 p9;\n" +
50             "\tint8 p10;\n" +
51             "\tint16 p11;\n" +
52             "\tint32 p12;\n" +
53             "\tint64 p13;\n" +
54             "\tsize_t p14;\n" +
55             "\tchar* p15;\n" +
56             "\tchar* p16;\n" +
57             "\tint* p17;\n" +
58             "\tint* p18;\n" +
59             "\tint* p19;\n" +
60             "\tint* p20;\n" +
61             "\tint add(int a, int b);\n" +
62             "};\n";
63 
64     private String genClassContentTest = "\nclass TestClass {\n" +
65             "\tchar* name;\n" +
66             "\tint age;\n" +
67             "\tlong p1;\n" +
68             "\tshort p2;\n" +
69             "\tlong long p3;\n" +
70             "\tfloat p4;\n" +
71             "\tdouble p5;\n" +
72             "\tuint8 p6;\n" +
73             "\tuint16 p7;\n" +
74             "\tuint32 p8;\n" +
75             "\tuint64 p9;\n" +
76             "\tint8 p10;\n" +
77             "\tint16 p11;\n" +
78             "\tint32 p12;\n" +
79             "\tint64 p13;\n" +
80             "\tsize_t p14;\n" +
81             "\tchar* p15;\n" +
82             "\tchar* p16;\n" +
83             "\tint* p17;\n" +
84             "\tint* p18;\n" +
85             "\tint* p19;\n" +
86             "\tint* p20;\n" +
87             "\tint delete(int);\n" +
88             "};\n";
89 
90     @Test
getInterfaceContent()91     void getInterfaceContent() {
92     }
93 
94     @Test
getVarContent24()95     void getVarContent24() {
96         ParamObj paObj = new ParamObj();
97         paObj.setName("num1");
98         paObj.setType("std::array<int>");
99         paObj.setStrValue("1");
100 
101         List<ParamObj> pol = new CopyOnWriteArrayList<>();
102         pol.add(paObj);
103         ParseObj po = new ParseObj();
104         po.setVarList(pol);
105         GeneratorBase gb = GenerateFactory.getGenerator("CH");
106         gb.genVarList(po.getVarList());
107 
108         if (gb instanceof GenCHFile gdf) {
109             String constContent = gdf.getConstContent();
110             System.out.println("getVar: " + constContent);
111             String expect = "\nextends const int* num1 = 1;\n";
112             assertEquals(expect, constContent);
113         }
114     }
115 
116     @Test
getVarContent25()117     void getVarContent25() {
118         ParamObj paObj = new ParamObj();
119         paObj.setName("num1");
120         paObj.setType("std::stack<int>");
121         paObj.setStrValue("1");
122 
123         List<ParamObj> pol = new CopyOnWriteArrayList<>();
124         pol.add(paObj);
125         ParseObj po = new ParseObj();
126         po.setVarList(pol);
127         GeneratorBase gb = GenerateFactory.getGenerator("CH");
128         gb.genVarList(po.getVarList());
129 
130         if (gb instanceof GenCHFile gdf) {
131             String constContent = gdf.getConstContent();
132             System.out.println("getVar: " + constContent);
133             String expect = "\nextends const int* num1 = 1;\n";
134             assertEquals(expect, constContent);
135         }
136     }
137 
138     @Test
getVarContent26()139     void getVarContent26() {
140         ParamObj paObj = new ParamObj();
141         paObj.setName("num1");
142         paObj.setType("std::vector<int>");
143         paObj.setStrValue("1");
144 
145         List<ParamObj> pol = new CopyOnWriteArrayList<>();
146         pol.add(paObj);
147         ParseObj po = new ParseObj();
148         po.setVarList(pol);
149         GeneratorBase gb = GenerateFactory.getGenerator("CH");
150         gb.genVarList(po.getVarList());
151 
152         if (gb instanceof GenCHFile gdf) {
153             String constContent = gdf.getConstContent();
154             System.out.println("getVar: " + constContent);
155             String expect = "\nextends const int* num1 = 1;\n";
156             assertEquals(expect, constContent);
157         }
158     }
159 
160     @Test
getVarContent27()161     void getVarContent27() {
162         ParamObj paObj = new ParamObj();
163         paObj.setName("num1");
164         paObj.setType("std::queue<int>");
165         paObj.setStrValue("1");
166 
167         List<ParamObj> pol = new CopyOnWriteArrayList<>();
168         pol.add(paObj);
169         ParseObj po = new ParseObj();
170         po.setVarList(pol);
171         GeneratorBase gb = GenerateFactory.getGenerator("CH");
172         gb.genVarList(po.getVarList());
173 
174         if (gb instanceof GenCHFile gdf) {
175             String constContent = gdf.getConstContent();
176             System.out.println("getVar: " + constContent);
177             String expect = "\nextends const int* num1 = 1;\n";
178             assertEquals(expect, constContent);
179         }
180     }
181 
182     @Test
getConstContent()183     void getConstContent() {
184         ParseObj po = new ParseObj();
185         ParamObj pao = new ParamObj();
186         pao.setName("TestParam");
187         pao.setType("int");
188         pao.setStrValue("100");
189         List<ParamObj> pol = new CopyOnWriteArrayList<>();
190         pol.add(pao);
191         po.setVarList(pol);
192 
193         GeneratorBase gb = GenerateFactory.getGenerator("CH");
194         gb.genVarList(pol);
195 
196         if (gb instanceof GenCHFile gdf) {
197             String varContent = gdf.getConstContent();
198             System.out.println("genVar: " + varContent);
199             String expect = "\nextends const int TestParam = 100;\n";
200             assertEquals(expect, varContent);
201         }
202     }
203 
204     @Test
genContent()205     void genContent() {
206         ParseObj po = new ParseObj();
207         ParamObj pao = new ParamObj();
208         pao.setName("TestParam");
209         pao.setType("int");
210         pao.setStrValue("100");
211         List<ParamObj> pol = new CopyOnWriteArrayList<>();
212         pol.add(pao);
213         po.setVarList(pol);
214 
215         GeneratorBase gb = GenerateFactory.getGenerator("CH");
216         gb.genContent(po);
217 
218         if (gb instanceof GenCHFile gdf) {
219             String varContent = gdf.getConstContent();
220             System.out.println("genVar: " + varContent);
221             String expect = "\nextends const int TestParam = 100;\n";
222             assertEquals(expect, varContent);
223         }
224     }
225 
226     @Test
genFile()227     void genFile() {
228         ParamObj pao = new ParamObj();
229         pao.setName("TestParam");
230         pao.setType("int");
231         pao.setStrValue("100");
232         List<ParamObj> pol = new CopyOnWriteArrayList<>();
233         pol.add(pao);
234 
235         ParseObj po = new ParseObj();
236         po.setVarList(pol);
237 
238         GeneratorBase gb = GenerateFactory.getGenerator("CH");
239         gb.genContent(po);
240         gb.genFile("./", "testGenFile.d.ts");
241 
242         File file = new File("./ag_testGenFile_d_ts.h");
243         assertEquals(true, file.exists());
244         assertEquals(false, file.isDirectory());
245 
246         List<String> fcList = readText("./ag_testGenFile_d_ts.h");
247 
248         assertEquals("// Generated from ./\\testGenFile.d.ts by KaiHong ohgen 1.0.0-PLUGIN",
249                 fcList.get(0));
250         assertEquals("extends const int TestParam = 100;",
251                 fcList.get(1));
252 
253         if (gb instanceof GenCHFile gdf) {
254             String varContent = gdf.getConstContent();
255             System.out.println("genVar: " + varContent);
256             String expect = "\nextends const int TestParam = 100;\n";
257             assertEquals(expect, varContent);
258         }
259     }
260 
261     @Test
genInterfaceList()262     void genInterfaceList() {
263     }
264 
265     @Test
genEnumList()266     void genEnumList() {
267         EnumObj eo = new EnumObj();
268         eo.setName("TestEnum");
269         List<String> ml = new CopyOnWriteArrayList<>();
270         ml.add("ONE");
271         ml.add("TWO");
272         eo.setMemberList(ml);
273         List<String> vl = new CopyOnWriteArrayList<>();
274         vl.add("1");
275         vl.add("2");
276         eo.setValueList(vl);
277         List<EnumObj> eol = new CopyOnWriteArrayList<>();
278         eol.add(eo);
279         ParseObj po = new ParseObj();
280         po.setEnumList(eol);
281         GeneratorBase gb = GenerateFactory.getGenerator("CH");
282         gb.genEnumList(po.getEnumList());
283 
284         if (gb instanceof GenCHFile gdf) {
285             String enumContent = gdf.getEnumContent();
286             System.out.println("genEnum: " + enumContent);
287             String expect = "\nenum TestEnum {\n" +
288                     "\tONE = 1,\n" +
289                     "\tTWO = 2,\n" +
290                     "};\n";
291             assertEquals(expect, enumContent);
292         }
293     }
294 
295     @Test
genClassList()296     void genClassList() {
297         ClassObj co = new ClassObj();
298         co.setName("TestClass");
299 
300         co.addParam("name", "string");
301         co.addParam("age", "number");
302         co.addParam("p1", "long");
303         co.addParam("p2", "short");
304         co.addParam("p3", "long long");
305         co.addParam("p4", "float");
306         co.addParam("p5", "double");
307         co.addParam("p6", "uint8");
308         co.addParam("p7", "uint16");
309         co.addParam("p8", "uint32");
310         co.addParam("p9", "uint64");
311         co.addParam("p10", "int8");
312         co.addParam("p11", "int16");
313         co.addParam("p12", "int32");
314         co.addParam("p13", "int64");
315         co.addParam("p14", "size_t");
316         co.addParam("p15", "string");
317         co.addParam("p16", "std::string");
318         co.addParam("p17", "std::array<int>");
319         co.addParam("p18", "std::stack<int>");
320         co.addParam("p19", "std::vector<int>");
321         co.addParam("p20", "std::queue<int>");
322 
323         List<ParamObj> poList = new CopyOnWriteArrayList<>();
324         ParamObj poItem = new ParamObj();
325         poItem.setType("number");
326         poList.add(poItem);
327 
328         co.addFunc("delete", "number", poList);
329 
330         List<ClassObj> col = new CopyOnWriteArrayList<>();
331         col.add(co);
332 
333         ParseObj po = new ParseObj();
334         po.setClassList(col);
335         GeneratorBase gb = GenerateFactory.getGenerator("CH");
336         gb.genClassList(po.getClassList());
337 
338         if (gb instanceof GenCHFile gdf) {
339             String classContent = gdf.getClassContent();
340             System.out.println("genClass: " + classContent);
341             String expect = genClassContentTest;
342             assertEquals(expect, classContent);
343         }
344     }
345 
346     @Test
genFuncList1()347     void genFuncList1() {
348         FuncObj fo = new FuncObj();
349         fo.setName("TestFunc");
350         fo.setRetValue("void");
351         fo.addParam("name", "string");
352         fo.addParam("age", "number");
353         List<FuncObj> fol = new CopyOnWriteArrayList<>();
354         fol.add(fo);
355         ParseObj po = new ParseObj();
356         po.setFuncList(fol);
357         GeneratorBase gb = GenerateFactory.getGenerator("CH");
358         gb.genFuncList(po.getFuncList());
359 
360         if (gb instanceof GenCHFile gdf) {
361             String funcContent = gdf.getFuncContent();
362             System.out.println("genFunc: " + funcContent);
363             String expect = "\nvoid TestFunc(char* name, int age);";
364             assertEquals(expect, funcContent);
365         }
366     }
367 
368     @Test
genFuncList2()369     void genFuncList2() {
370         FuncObj fo = new FuncObj();
371         fo.setName("TestFunc");
372         fo.setRetValue("void");
373         fo.addParam("name", "string");
374         fo.addParam("age", "int");
375         List<FuncObj> fol = new CopyOnWriteArrayList<>();
376         fol.add(fo);
377         ParseObj po = new ParseObj();
378         po.setFuncList(fol);
379         GeneratorBase gb = GenerateFactory.getGenerator("CH");
380         gb.genFuncList(po.getFuncList());
381 
382         if (gb instanceof GenCHFile gdf) {
383             String funcContent = gdf.getFuncContent();
384             System.out.println("genFunc: " + funcContent);
385             String expect = "\nvoid TestFunc(char* name, int age);";
386             assertEquals(expect, funcContent);
387         }
388     }
389 
390     @Test
genFuncList3()391     void genFuncList3() {
392         FuncObj fo = new FuncObj();
393         fo.setName("TestFunc");
394         fo.setRetValue("void");
395         fo.addParam("name", "string");
396         fo.addParam("age", "long");
397         List<FuncObj> fol = new CopyOnWriteArrayList<>();
398         fol.add(fo);
399         ParseObj po = new ParseObj();
400         po.setFuncList(fol);
401         GeneratorBase gb = GenerateFactory.getGenerator("CH");
402         gb.genFuncList(po.getFuncList());
403 
404         if (gb instanceof GenCHFile gdf) {
405             String funcContent = gdf.getFuncContent();
406             System.out.println("genFunc: " + funcContent);
407             String expect = "\nvoid TestFunc(char* name, long age);";
408             assertEquals(expect, funcContent);
409         }
410     }
411 
412     @Test
genFuncList4()413     void genFuncList4() {
414         FuncObj fo = new FuncObj();
415         fo.setName("TestFunc");
416         fo.setRetValue("void");
417         fo.addParam("name", "string");
418         fo.addParam("age", "short");
419         List<FuncObj> fol = new CopyOnWriteArrayList<>();
420         fol.add(fo);
421         ParseObj po = new ParseObj();
422         po.setFuncList(fol);
423         GeneratorBase gb = GenerateFactory.getGenerator("CH");
424         gb.genFuncList(po.getFuncList());
425 
426         if (gb instanceof GenCHFile gdf) {
427             String funcContent = gdf.getFuncContent();
428             System.out.println("genFunc: " + funcContent);
429             String expect = "\nvoid TestFunc(char* name, short age);";
430             assertEquals(expect, funcContent);
431         }
432     }
433 
434     @Test
genFuncList5()435     void genFuncList5() {
436         FuncObj fo = new FuncObj();
437         fo.setName("TestFunc");
438         fo.setRetValue("void");
439         fo.addParam("name", "string");
440         fo.addParam("age", "long long");
441         List<FuncObj> fol = new CopyOnWriteArrayList<>();
442         fol.add(fo);
443         ParseObj po = new ParseObj();
444         po.setFuncList(fol);
445         GeneratorBase gb = GenerateFactory.getGenerator("CH");
446         gb.genFuncList(po.getFuncList());
447 
448         if (gb instanceof GenCHFile gdf) {
449             String funcContent = gdf.getFuncContent();
450             System.out.println("genFunc: " + funcContent);
451             String expect = "\nvoid TestFunc(char* name, long long age);";
452             assertEquals(expect, funcContent);
453         }
454     }
455 
456     @Test
genFuncList6()457     void genFuncList6() {
458         FuncObj fo = new FuncObj();
459         fo.setName("TestFunc");
460         fo.setRetValue("void");
461         fo.addParam("name", "string");
462         fo.addParam("age", "float");
463         List<FuncObj> fol = new CopyOnWriteArrayList<>();
464         fol.add(fo);
465         ParseObj po = new ParseObj();
466         po.setFuncList(fol);
467         GeneratorBase gb = GenerateFactory.getGenerator("CH");
468         gb.genFuncList(po.getFuncList());
469 
470         if (gb instanceof GenCHFile gdf) {
471             String funcContent = gdf.getFuncContent();
472             System.out.println("genFunc: " + funcContent);
473             String expect = "\nvoid TestFunc(char* name, float age);";
474             assertEquals(expect, funcContent);
475         }
476     }
477 
478     @Test
genFuncList7()479     void genFuncList7() {
480         FuncObj fo = new FuncObj();
481         fo.setName("TestFunc");
482         fo.setRetValue("void");
483         fo.addParam("name", "string");
484         fo.addParam("age", "double");
485         List<FuncObj> fol = new CopyOnWriteArrayList<>();
486         fol.add(fo);
487         ParseObj po = new ParseObj();
488         po.setFuncList(fol);
489         GeneratorBase gb = GenerateFactory.getGenerator("CH");
490         gb.genFuncList(po.getFuncList());
491 
492         if (gb instanceof GenCHFile gdf) {
493             String funcContent = gdf.getFuncContent();
494             System.out.println("genFunc: " + funcContent);
495             String expect = "\nvoid TestFunc(char* name, double age);";
496             assertEquals(expect, funcContent);
497         }
498     }
499 
500     @Test
genFuncList8()501     void genFuncList8() {
502         FuncObj fo = new FuncObj();
503         fo.setName("TestFunc");
504         fo.setRetValue("void");
505         fo.addParam("name", "string");
506         fo.addParam("age", "uint8");
507         List<FuncObj> fol = new CopyOnWriteArrayList<>();
508         fol.add(fo);
509         ParseObj po = new ParseObj();
510         po.setFuncList(fol);
511         GeneratorBase gb = GenerateFactory.getGenerator("CH");
512         gb.genFuncList(po.getFuncList());
513 
514         if (gb instanceof GenCHFile gdf) {
515             String funcContent = gdf.getFuncContent();
516             System.out.println("genFunc: " + funcContent);
517             String expect = "\nvoid TestFunc(char* name, uint8 age);";
518             assertEquals(expect, funcContent);
519         }
520     }
521 
522     @Test
genFuncList9()523     void genFuncList9() {
524         FuncObj fo = new FuncObj();
525         fo.setName("TestFunc");
526         fo.setRetValue("void");
527         fo.addParam("name", "string");
528         fo.addParam("age", "uint16");
529         List<FuncObj> fol = new CopyOnWriteArrayList<>();
530         fol.add(fo);
531         ParseObj po = new ParseObj();
532         po.setFuncList(fol);
533         GeneratorBase gb = GenerateFactory.getGenerator("CH");
534         gb.genFuncList(po.getFuncList());
535 
536         if (gb instanceof GenCHFile gdf) {
537             String funcContent = gdf.getFuncContent();
538             System.out.println("genFunc: " + funcContent);
539             String expect = "\nvoid TestFunc(char* name, uint16 age);";
540             assertEquals(expect, funcContent);
541         }
542     }
543 
544     @Test
genFuncList10()545     void genFuncList10() {
546         FuncObj fo = new FuncObj();
547         fo.setName("TestFunc");
548         fo.setRetValue("void");
549         fo.addParam("name", "string");
550         fo.addParam("age", "uint32");
551         List<FuncObj> fol = new CopyOnWriteArrayList<>();
552         fol.add(fo);
553         ParseObj po = new ParseObj();
554         po.setFuncList(fol);
555         GeneratorBase gb = GenerateFactory.getGenerator("CH");
556         gb.genFuncList(po.getFuncList());
557 
558         if (gb instanceof GenCHFile gdf) {
559             String funcContent = gdf.getFuncContent();
560             System.out.println("genFunc: " + funcContent);
561             String expect = "\nvoid TestFunc(char* name, uint32 age);";
562             assertEquals(expect, funcContent);
563         }
564     }
565 
566     @Test
genFuncList11()567     void genFuncList11() {
568         FuncObj fo = new FuncObj();
569         fo.setName("TestFunc");
570         fo.setRetValue("void");
571         fo.addParam("name", "string");
572         fo.addParam("age", "uint64");
573         List<FuncObj> fol = new CopyOnWriteArrayList<>();
574         fol.add(fo);
575         ParseObj po = new ParseObj();
576         po.setFuncList(fol);
577         GeneratorBase gb = GenerateFactory.getGenerator("CH");
578         gb.genFuncList(po.getFuncList());
579 
580         if (gb instanceof GenCHFile gdf) {
581             String funcContent = gdf.getFuncContent();
582             System.out.println("genFunc: " + funcContent);
583             String expect = "\nvoid TestFunc(char* name, uint64 age);";
584             assertEquals(expect, funcContent);
585         }
586     }
587 
588     @Test
genFuncList12()589     void genFuncList12() {
590         FuncObj fo = new FuncObj();
591         fo.setName("TestFunc");
592         fo.setRetValue("void");
593         fo.addParam("name", "string");
594         fo.addParam("age", "int8");
595         List<FuncObj> fol = new CopyOnWriteArrayList<>();
596         fol.add(fo);
597         ParseObj po = new ParseObj();
598         po.setFuncList(fol);
599         GeneratorBase gb = GenerateFactory.getGenerator("CH");
600         gb.genFuncList(po.getFuncList());
601 
602         if (gb instanceof GenCHFile gdf) {
603             String funcContent = gdf.getFuncContent();
604             System.out.println("genFunc: " + funcContent);
605             String expect = "\nvoid TestFunc(char* name, int8 age);";
606             assertEquals(expect, funcContent);
607         }
608     }
609 
610     @Test
genFuncList13()611     void genFuncList13() {
612         FuncObj fo = new FuncObj();
613         fo.setName("TestFunc");
614         fo.setRetValue("void");
615         fo.addParam("name", "string");
616         fo.addParam("age", "int16");
617         List<FuncObj> fol = new CopyOnWriteArrayList<>();
618         fol.add(fo);
619         ParseObj po = new ParseObj();
620         po.setFuncList(fol);
621         GeneratorBase gb = GenerateFactory.getGenerator("CH");
622         gb.genFuncList(po.getFuncList());
623 
624         if (gb instanceof GenCHFile gdf) {
625             String funcContent = gdf.getFuncContent();
626             System.out.println("genFunc: " + funcContent);
627             String expect = "\nvoid TestFunc(char* name, int16 age);";
628             assertEquals(expect, funcContent);
629         }
630     }
631 
632     @Test
genFuncList14()633     void genFuncList14() {
634         FuncObj fo = new FuncObj();
635         fo.setName("TestFunc");
636         fo.setRetValue("void");
637         fo.addParam("name", "string");
638         fo.addParam("age", "int32");
639         List<FuncObj> fol = new CopyOnWriteArrayList<>();
640         fol.add(fo);
641         ParseObj po = new ParseObj();
642         po.setFuncList(fol);
643         GeneratorBase gb = GenerateFactory.getGenerator("CH");
644         gb.genFuncList(po.getFuncList());
645 
646         if (gb instanceof GenCHFile gdf) {
647             String funcContent = gdf.getFuncContent();
648             System.out.println("genFunc: " + funcContent);
649             String expect = "\nvoid TestFunc(char* name, int32 age);";
650             assertEquals(expect, funcContent);
651         }
652     }
653 
654     @Test
genFuncList15()655     void genFuncList15() {
656         FuncObj fo = new FuncObj();
657         fo.setName("TestFunc");
658         fo.setRetValue("void");
659         fo.addParam("name", "string");
660         fo.addParam("age", "int64");
661         List<FuncObj> fol = new CopyOnWriteArrayList<>();
662         fol.add(fo);
663         ParseObj po = new ParseObj();
664         po.setFuncList(fol);
665         GeneratorBase gb = GenerateFactory.getGenerator("CH");
666         gb.genFuncList(po.getFuncList());
667 
668         if (gb instanceof GenCHFile gdf) {
669             String funcContent = gdf.getFuncContent();
670             System.out.println("genFunc: " + funcContent);
671             String expect = "\nvoid TestFunc(char* name, int64 age);";
672             assertEquals(expect, funcContent);
673         }
674     }
675 
676     @Test
genFuncList16()677     void genFuncList16() {
678         FuncObj fo = new FuncObj();
679         fo.setName("TestFunc");
680         fo.setRetValue("void");
681         fo.addParam("name", "string");
682         fo.addParam("age", "size_t");
683         List<FuncObj> fol = new CopyOnWriteArrayList<>();
684         fol.add(fo);
685         ParseObj po = new ParseObj();
686         po.setFuncList(fol);
687         GeneratorBase gb = GenerateFactory.getGenerator("CH");
688         gb.genFuncList(po.getFuncList());
689 
690         if (gb instanceof GenCHFile gdf) {
691             String funcContent = gdf.getFuncContent();
692             System.out.println("genFunc: " + funcContent);
693             String expect = "\nvoid TestFunc(char* name, size_t age);";
694             assertEquals(expect, funcContent);
695         }
696     }
697 
698     @Test
genFuncList17()699     void genFuncList17() {
700         FuncObj fo = new FuncObj();
701         fo.setName("TestFunc");
702         fo.setRetValue("void");
703         fo.addParam("name", "string");
704         fo.addParam("age", "string");
705         List<FuncObj> fol = new CopyOnWriteArrayList<>();
706         fol.add(fo);
707         ParseObj po = new ParseObj();
708         po.setFuncList(fol);
709         GeneratorBase gb = GenerateFactory.getGenerator("CH");
710         gb.genFuncList(po.getFuncList());
711 
712         if (gb instanceof GenCHFile gdf) {
713             String funcContent = gdf.getFuncContent();
714             System.out.println("genFunc: " + funcContent);
715             String expect = "\nvoid TestFunc(char* name, char* age);";
716             assertEquals(expect, funcContent);
717         }
718     }
719 
720     @Test
genFuncList18()721     void genFuncList18() {
722         FuncObj fo = new FuncObj();
723         fo.setName("TestFunc");
724         fo.setRetValue("void");
725         fo.addParam("name", "string");
726         fo.addParam("age", "std::string");
727         List<FuncObj> fol = new CopyOnWriteArrayList<>();
728         fol.add(fo);
729         ParseObj po = new ParseObj();
730         po.setFuncList(fol);
731         GeneratorBase gb = GenerateFactory.getGenerator("CH");
732         gb.genFuncList(po.getFuncList());
733 
734         if (gb instanceof GenCHFile gdf) {
735             String funcContent = gdf.getFuncContent();
736             System.out.println("genFunc: " + funcContent);
737             String expect = "\nvoid TestFunc(char* name, char* age);";
738             assertEquals(expect, funcContent);
739         }
740     }
741 
742     @Test
genFuncList19()743     void genFuncList19() {
744         FuncObj fo = new FuncObj();
745         fo.setName("TestFunc");
746         fo.setRetValue("void");
747         fo.addParam("name", "string");
748         fo.addParam("age", "std::array<int>");
749         List<FuncObj> fol = new CopyOnWriteArrayList<>();
750         fol.add(fo);
751         ParseObj po = new ParseObj();
752         po.setFuncList(fol);
753         GeneratorBase gb = GenerateFactory.getGenerator("CH");
754         gb.genFuncList(po.getFuncList());
755 
756         if (gb instanceof GenCHFile gdf) {
757             String funcContent = gdf.getFuncContent();
758             System.out.println("genFunc: " + funcContent);
759             String expect = "\nvoid TestFunc(char* name, int* age);";
760             assertEquals(expect, funcContent);
761         }
762     }
763 
764     @Test
genFuncList20()765     void genFuncList20() {
766         FuncObj fo = new FuncObj();
767         fo.setName("TestFunc");
768         fo.setRetValue("void");
769         fo.addParam("name", "string");
770         fo.addParam("age", "std::stack<int>");
771         List<FuncObj> fol = new CopyOnWriteArrayList<>();
772         fol.add(fo);
773         ParseObj po = new ParseObj();
774         po.setFuncList(fol);
775         GeneratorBase gb = GenerateFactory.getGenerator("CH");
776         gb.genFuncList(po.getFuncList());
777 
778         if (gb instanceof GenCHFile gdf) {
779             String funcContent = gdf.getFuncContent();
780             System.out.println("genFunc: " + funcContent);
781             String expect = "\nvoid TestFunc(char* name, int* age);";
782             assertEquals(expect, funcContent);
783         }
784     }
785 
786     @Test
genFuncList21()787     void genFuncList21() {
788         FuncObj fo = new FuncObj();
789         fo.setName("TestFunc");
790         fo.setRetValue("void");
791         fo.addParam("name", "string");
792         fo.addParam("age", "std::vector<int>");
793         List<FuncObj> fol = new CopyOnWriteArrayList<>();
794         fol.add(fo);
795         ParseObj po = new ParseObj();
796         po.setFuncList(fol);
797         GeneratorBase gb = GenerateFactory.getGenerator("CH");
798         gb.genFuncList(po.getFuncList());
799 
800         if (gb instanceof GenCHFile gdf) {
801             String funcContent = gdf.getFuncContent();
802             System.out.println("genFunc: " + funcContent);
803             String expect = "\nvoid TestFunc(char* name, int* age);";
804             assertEquals(expect, funcContent);
805         }
806     }
807 
808     @Test
genFuncList22()809     void genFuncList22() {
810         FuncObj fo = new FuncObj();
811         fo.setName("TestFunc");
812         fo.setRetValue("void");
813         fo.addParam("name", "string");
814         fo.addParam("age", "std::queue<int>");
815         List<FuncObj> fol = new CopyOnWriteArrayList<>();
816         fol.add(fo);
817         ParseObj po = new ParseObj();
818         po.setFuncList(fol);
819         GeneratorBase gb = GenerateFactory.getGenerator("CH");
820         gb.genFuncList(po.getFuncList());
821 
822         if (gb instanceof GenCHFile gdf) {
823             String funcContent = gdf.getFuncContent();
824             System.out.println("genFunc: " + funcContent);
825             String expect = "\nvoid TestFunc(char* name, int* age);";
826             assertEquals(expect, funcContent);
827         }
828     }
829 
830     @Test
genStructList()831     void genStructList() {
832         StructObj so = new StructObj();
833         so.setName("TestStruct");
834 
835         so.addMember("name", "string");
836         so.addMember("age", "number");
837         so.addMember("p1", "long");
838         so.addMember("p2", "short");
839         so.addMember("p3", "long long");
840         so.addMember("p4", "float");
841         so.addMember("p5", "double");
842         so.addMember("p6", "uint8");
843         so.addMember("p7", "uint16");
844         so.addMember("p8", "uint32");
845         so.addMember("p9", "uint64");
846         so.addMember("p10", "int8");
847         so.addMember("p11", "int16");
848         so.addMember("p12", "int32");
849         so.addMember("p13", "int64");
850         so.addMember("p14", "size_t");
851         so.addMember("p15", "string");
852         so.addMember("p16", "std::string");
853         so.addMember("p17", "std::array<int>");
854         so.addMember("p18", "std::stack<int>");
855         so.addMember("p19", "std::vector<int>");
856         so.addMember("p20", "std::queue<int>");
857 
858         List<ParamObj> poList = new CopyOnWriteArrayList<>();
859         ParamObj poItem = new ParamObj();
860         poItem.setName("a");
861         poItem.setType("int");
862         poList.add(poItem);
863         ParamObj poItem2 = new ParamObj();
864         poItem2.setName("b");
865         poItem2.setType("int");
866         poList.add(poItem2);
867 
868         so.addFunc("add", "int", poList);
869 
870         List<StructObj> sol = new CopyOnWriteArrayList<>();
871         sol.add(so);
872         ParseObj po = new ParseObj();
873         po.setStructList(sol);
874 
875         GeneratorBase gb = GenerateFactory.getGenerator("CH");
876         gb.genStructList(po.getStructList());
877 
878         if (gb instanceof GenCHFile gdf) {
879             String structContent = gdf.getStructContent();
880             System.out.println("genStruct: " + structContent);
881             String expect = genUnionContentTest;
882             assertEquals(expect, structContent);
883         }
884     }
885 
886     @Test
genTypeList()887     void genTypeList() {
888         TypeObj to = new TypeObj();
889     }
890 
891     @Test
genUnionList1()892     void genUnionList1() {
893         UnionObj uo = new UnionObj();
894         uo.setName("TestUnion");
895 
896         uo.addMember("name", "any");
897         uo.addMember("age", "number");
898 
899         List<UnionObj> uol = new CopyOnWriteArrayList<>();
900         uol.add(uo);
901         ParseObj po = new ParseObj();
902         po.setUnionList(uol);
903         GeneratorBase gb = GenerateFactory.getGenerator("CH");
904         gb.genUnionList(po.getUnionList());
905 
906         if (gb instanceof GenCHFile gdf) {
907             String unionContent = gdf.getUnionContent();
908             System.out.println("genUnion: " + unionContent);
909             String expect = "\nunion TestUnion{\n" +
910                     "\tauto name;\n" +
911                     "\tint age;\n" +
912                     "};\n";
913             assertEquals(expect, unionContent);
914         }
915     }
916 
917     @Test
genUnionList2()918     void genUnionList2() {
919         UnionObj uo = new UnionObj();
920         uo.setName("TestUnion");
921 
922         uo.addMember("name", "any");
923         uo.addMember("age", "int");
924 
925         List<UnionObj> uol = new CopyOnWriteArrayList<>();
926         uol.add(uo);
927         ParseObj po = new ParseObj();
928         po.setUnionList(uol);
929         GeneratorBase gb = GenerateFactory.getGenerator("CH");
930         gb.genUnionList(po.getUnionList());
931 
932         if (gb instanceof GenCHFile gdf) {
933             String unionContent = gdf.getUnionContent();
934             System.out.println("genUnion: " + unionContent);
935             String expect = "\nunion TestUnion{\n" +
936                     "\tauto name;\n" +
937                     "\tint age;\n" +
938                     "};\n";
939             assertEquals(expect, unionContent);
940         }
941     }
942 
943     @Test
genUnionList3()944     void genUnionList3() {
945         UnionObj uo = new UnionObj();
946         uo.setName("TestUnion");
947 
948         uo.addMember("name", "any");
949         uo.addMember("age", "long");
950 
951         List<UnionObj> uol = new CopyOnWriteArrayList<>();
952         uol.add(uo);
953         ParseObj po = new ParseObj();
954         po.setUnionList(uol);
955         GeneratorBase gb = GenerateFactory.getGenerator("CH");
956         gb.genUnionList(po.getUnionList());
957 
958         if (gb instanceof GenCHFile gdf) {
959             String unionContent = gdf.getUnionContent();
960             System.out.println("genUnion: " + unionContent);
961             String expect = "\nunion TestUnion{\n" +
962                     "\tauto name;\n" +
963                     "\tlong age;\n" +
964                     "};\n";
965             assertEquals(expect, unionContent);
966         }
967     }
968 
969     @Test
genUnionList4()970     void genUnionList4() {
971         UnionObj uo = new UnionObj();
972         uo.setName("TestUnion");
973 
974         uo.addMember("name", "any");
975         uo.addMember("age", "short");
976 
977         List<UnionObj> uol = new CopyOnWriteArrayList<>();
978         uol.add(uo);
979         ParseObj po = new ParseObj();
980         po.setUnionList(uol);
981         GeneratorBase gb = GenerateFactory.getGenerator("CH");
982         gb.genUnionList(po.getUnionList());
983 
984         if (gb instanceof GenCHFile gdf) {
985             String unionContent = gdf.getUnionContent();
986             System.out.println("genUnion: " + unionContent);
987             String expect = "\nunion TestUnion{\n" +
988                     "\tauto name;\n" +
989                     "\tshort age;\n" +
990                     "};\n";
991             assertEquals(expect, unionContent);
992         }
993     }
994 
995     @Test
genUnionList5()996     void genUnionList5() {
997         UnionObj uo = new UnionObj();
998         uo.setName("TestUnion");
999 
1000         uo.addMember("name", "any");
1001         uo.addMember("age", "long long");
1002 
1003         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1004         uol.add(uo);
1005         ParseObj po = new ParseObj();
1006         po.setUnionList(uol);
1007         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1008         gb.genUnionList(po.getUnionList());
1009 
1010         if (gb instanceof GenCHFile gdf) {
1011             String unionContent = gdf.getUnionContent();
1012             System.out.println("genUnion: " + unionContent);
1013             String expect = "\nunion TestUnion{\n" +
1014                     "\tauto name;\n" +
1015                     "\tlong long age;\n" +
1016                     "};\n";
1017             assertEquals(expect, unionContent);
1018         }
1019     }
1020 
1021     @Test
genUnionList6()1022     void genUnionList6() {
1023         UnionObj uo = new UnionObj();
1024         uo.setName("TestUnion");
1025 
1026         uo.addMember("name", "any");
1027         uo.addMember("age", "float");
1028 
1029         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1030         uol.add(uo);
1031         ParseObj po = new ParseObj();
1032         po.setUnionList(uol);
1033         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1034         gb.genUnionList(po.getUnionList());
1035 
1036         if (gb instanceof GenCHFile gdf) {
1037             String unionContent = gdf.getUnionContent();
1038             System.out.println("genUnion: " + unionContent);
1039             String expect = "\nunion TestUnion{\n" +
1040                     "\tauto name;\n" +
1041                     "\tfloat age;\n" +
1042                     "};\n";
1043             assertEquals(expect, unionContent);
1044         }
1045     }
1046 
1047     @Test
genUnionList7()1048     void genUnionList7() {
1049         UnionObj uo = new UnionObj();
1050         uo.setName("TestUnion");
1051 
1052         uo.addMember("name", "any");
1053         uo.addMember("age", "double");
1054 
1055         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1056         uol.add(uo);
1057         ParseObj po = new ParseObj();
1058         po.setUnionList(uol);
1059         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1060         gb.genUnionList(po.getUnionList());
1061 
1062         if (gb instanceof GenCHFile gdf) {
1063             String unionContent = gdf.getUnionContent();
1064             System.out.println("genUnion: " + unionContent);
1065             String expect = "\nunion TestUnion{\n" +
1066                     "\tauto name;\n" +
1067                     "\tdouble age;\n" +
1068                     "};\n";
1069             assertEquals(expect, unionContent);
1070         }
1071     }
1072 
1073     @Test
genUnionList8()1074     void genUnionList8() {
1075         UnionObj uo = new UnionObj();
1076         uo.setName("TestUnion");
1077 
1078         uo.addMember("name", "any");
1079         uo.addMember("age", "uint8");
1080 
1081         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1082         uol.add(uo);
1083         ParseObj po = new ParseObj();
1084         po.setUnionList(uol);
1085         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1086         gb.genUnionList(po.getUnionList());
1087 
1088         if (gb instanceof GenCHFile gdf) {
1089             String unionContent = gdf.getUnionContent();
1090             System.out.println("genUnion: " + unionContent);
1091             String expect = "\nunion TestUnion{\n" +
1092                     "\tauto name;\n" +
1093                     "\tuint8 age;\n" +
1094                     "};\n";
1095             assertEquals(expect, unionContent);
1096         }
1097     }
1098 
1099     @Test
genUnionList9()1100     void genUnionList9() {
1101         UnionObj uo = new UnionObj();
1102         uo.setName("TestUnion");
1103 
1104         uo.addMember("name", "any");
1105         uo.addMember("age", "uint16");
1106 
1107         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1108         uol.add(uo);
1109         ParseObj po = new ParseObj();
1110         po.setUnionList(uol);
1111         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1112         gb.genUnionList(po.getUnionList());
1113 
1114         if (gb instanceof GenCHFile gdf) {
1115             String unionContent = gdf.getUnionContent();
1116             System.out.println("genUnion: " + unionContent);
1117             String expect = "\nunion TestUnion{\n" +
1118                     "\tauto name;\n" +
1119                     "\tuint16 age;\n" +
1120                     "};\n";
1121             assertEquals(expect, unionContent);
1122         }
1123     }
1124 
1125     @Test
genUnionList10()1126     void genUnionList10() {
1127         UnionObj uo = new UnionObj();
1128         uo.setName("TestUnion");
1129 
1130         uo.addMember("name", "any");
1131         uo.addMember("age", "uint32");
1132 
1133         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1134         uol.add(uo);
1135         ParseObj po = new ParseObj();
1136         po.setUnionList(uol);
1137         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1138         gb.genUnionList(po.getUnionList());
1139 
1140         if (gb instanceof GenCHFile gdf) {
1141             String unionContent = gdf.getUnionContent();
1142             System.out.println("genUnion: " + unionContent);
1143             String expect = "\nunion TestUnion{\n" +
1144                     "\tauto name;\n" +
1145                     "\tuint32 age;\n" +
1146                     "};\n";
1147             assertEquals(expect, unionContent);
1148         }
1149     }
1150     @Test
genUnionList11()1151     void genUnionList11() {
1152         UnionObj uo = new UnionObj();
1153         uo.setName("TestUnion");
1154 
1155         uo.addMember("name", "any");
1156         uo.addMember("age", "uint64");
1157 
1158         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1159         uol.add(uo);
1160         ParseObj po = new ParseObj();
1161         po.setUnionList(uol);
1162         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1163         gb.genUnionList(po.getUnionList());
1164 
1165         if (gb instanceof GenCHFile gdf) {
1166             String unionContent = gdf.getUnionContent();
1167             System.out.println("genUnion: " + unionContent);
1168             String expect = "\nunion TestUnion{\n" +
1169                     "\tauto name;\n" +
1170                     "\tuint64 age;\n" +
1171                     "};\n";
1172             assertEquals(expect, unionContent);
1173         }
1174     }
1175 
1176     @Test
genUnionList12()1177     void genUnionList12() {
1178         UnionObj uo = new UnionObj();
1179         uo.setName("TestUnion");
1180 
1181         uo.addMember("name", "any");
1182         uo.addMember("age", "int8");
1183 
1184         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1185         uol.add(uo);
1186         ParseObj po = new ParseObj();
1187         po.setUnionList(uol);
1188         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1189         gb.genUnionList(po.getUnionList());
1190 
1191         if (gb instanceof GenCHFile gdf) {
1192             String unionContent = gdf.getUnionContent();
1193             System.out.println("genUnion: " + unionContent);
1194             String expect = "\nunion TestUnion{\n" +
1195                     "\tauto name;\n" +
1196                     "\tint8 age;\n" +
1197                     "};\n";
1198             assertEquals(expect, unionContent);
1199         }
1200     }
1201 
1202     @Test
genUnionList13()1203     void genUnionList13() {
1204         UnionObj uo = new UnionObj();
1205         uo.setName("TestUnion");
1206 
1207         uo.addMember("name", "any");
1208         uo.addMember("age", "int16");
1209 
1210         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1211         uol.add(uo);
1212         ParseObj po = new ParseObj();
1213         po.setUnionList(uol);
1214         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1215         gb.genUnionList(po.getUnionList());
1216 
1217         if (gb instanceof GenCHFile gdf) {
1218             String unionContent = gdf.getUnionContent();
1219             System.out.println("genUnion: " + unionContent);
1220             String expect = "\nunion TestUnion{\n" +
1221                     "\tauto name;\n" +
1222                     "\tint16 age;\n" +
1223                     "};\n";
1224             assertEquals(expect, unionContent);
1225         }
1226     }
1227 
1228     @Test
genUnionList14()1229     void genUnionList14() {
1230         UnionObj uo = new UnionObj();
1231         uo.setName("TestUnion");
1232 
1233         uo.addMember("name", "any");
1234         uo.addMember("age", "int32");
1235 
1236         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1237         uol.add(uo);
1238         ParseObj po = new ParseObj();
1239         po.setUnionList(uol);
1240         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1241         gb.genUnionList(po.getUnionList());
1242 
1243         if (gb instanceof GenCHFile gdf) {
1244             String unionContent = gdf.getUnionContent();
1245             System.out.println("genUnion: " + unionContent);
1246             String expect = "\nunion TestUnion{\n" +
1247                     "\tauto name;\n" +
1248                     "\tint32 age;\n" +
1249                     "};\n";
1250             assertEquals(expect, unionContent);
1251         }
1252     }
1253 
1254     @Test
genUnionList15()1255     void genUnionList15() {
1256         UnionObj uo = new UnionObj();
1257         uo.setName("TestUnion");
1258 
1259         uo.addMember("name", "any");
1260         uo.addMember("age", "int64");
1261 
1262         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1263         uol.add(uo);
1264         ParseObj po = new ParseObj();
1265         po.setUnionList(uol);
1266         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1267         gb.genUnionList(po.getUnionList());
1268 
1269         if (gb instanceof GenCHFile gdf) {
1270             String unionContent = gdf.getUnionContent();
1271             System.out.println("genUnion: " + unionContent);
1272             String expect = "\nunion TestUnion{\n" +
1273                     "\tauto name;\n" +
1274                     "\tint64 age;\n" +
1275                     "};\n";
1276             assertEquals(expect, unionContent);
1277         }
1278     }
1279 
1280     @Test
genUnionList16()1281     void genUnionList16() {
1282         UnionObj uo = new UnionObj();
1283         uo.setName("TestUnion");
1284 
1285         uo.addMember("name", "any");
1286         uo.addMember("age", "size_t");
1287 
1288         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1289         uol.add(uo);
1290         ParseObj po = new ParseObj();
1291         po.setUnionList(uol);
1292         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1293         gb.genUnionList(po.getUnionList());
1294 
1295         if (gb instanceof GenCHFile gdf) {
1296             String unionContent = gdf.getUnionContent();
1297             System.out.println("genUnion: " + unionContent);
1298             String expect = "\nunion TestUnion{\n" +
1299                     "\tauto name;\n" +
1300                     "\tsize_t age;\n" +
1301                     "};\n";
1302             assertEquals(expect, unionContent);
1303         }
1304     }
1305 
1306     @Test
genUnionList17()1307     void genUnionList17() {
1308         UnionObj uo = new UnionObj();
1309         uo.setName("TestUnion");
1310 
1311         uo.addMember("name", "any");
1312         uo.addMember("age", "string");
1313 
1314         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1315         uol.add(uo);
1316         ParseObj po = new ParseObj();
1317         po.setUnionList(uol);
1318         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1319         gb.genUnionList(po.getUnionList());
1320 
1321         if (gb instanceof GenCHFile gdf) {
1322             String unionContent = gdf.getUnionContent();
1323             System.out.println("genUnion: " + unionContent);
1324             String expect = "\nunion TestUnion{\n" +
1325                     "\tauto name;\n" +
1326                     "\tchar* age;\n" +
1327                     "};\n";
1328             assertEquals(expect, unionContent);
1329         }
1330     }
1331 
1332     @Test
genUnionList18()1333     void genUnionList18() {
1334         UnionObj uo = new UnionObj();
1335         uo.setName("TestUnion");
1336 
1337         uo.addMember("name", "any");
1338         uo.addMember("age", "std::string");
1339 
1340         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1341         uol.add(uo);
1342         ParseObj po = new ParseObj();
1343         po.setUnionList(uol);
1344         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1345         gb.genUnionList(po.getUnionList());
1346 
1347         if (gb instanceof GenCHFile gdf) {
1348             String unionContent = gdf.getUnionContent();
1349             System.out.println("genUnion: " + unionContent);
1350             String expect = "\nunion TestUnion{\n" +
1351                     "\tauto name;\n" +
1352                     "\tchar* age;\n" +
1353                     "};\n";
1354             assertEquals(expect, unionContent);
1355         }
1356     }
1357 
1358     @Test
genUnionList19()1359     void genUnionList19() {
1360         UnionObj uo = new UnionObj();
1361         uo.setName("TestUnion");
1362 
1363         uo.addMember("name", "any");
1364         uo.addMember("age", "std::array<int>");
1365 
1366         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1367         uol.add(uo);
1368         ParseObj po = new ParseObj();
1369         po.setUnionList(uol);
1370         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1371         gb.genUnionList(po.getUnionList());
1372 
1373         if (gb instanceof GenCHFile gdf) {
1374             String unionContent = gdf.getUnionContent();
1375             System.out.println("genUnion: " + unionContent);
1376             String expect = "\nunion TestUnion{\n" +
1377                     "\tauto name;\n" +
1378                     "\tint* age;\n" +
1379                     "};\n";
1380             assertEquals(expect, unionContent);
1381         }
1382     }
1383 
1384     @Test
genUnionList20()1385     void genUnionList20() {
1386         UnionObj uo = new UnionObj();
1387         uo.setName("TestUnion");
1388 
1389         uo.addMember("name", "any");
1390         uo.addMember("age", "std::stack<int>");
1391 
1392         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1393         uol.add(uo);
1394         ParseObj po = new ParseObj();
1395         po.setUnionList(uol);
1396         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1397         gb.genUnionList(po.getUnionList());
1398 
1399         if (gb instanceof GenCHFile gdf) {
1400             String unionContent = gdf.getUnionContent();
1401             System.out.println("genUnion: " + unionContent);
1402             String expect = "\nunion TestUnion{\n" +
1403                     "\tauto name;\n" +
1404                     "\tint* age;\n" +
1405                     "};\n";
1406             assertEquals(expect, unionContent);
1407         }
1408     }
1409 
1410     @Test
genUnionList21()1411     void genUnionList21() {
1412         UnionObj uo = new UnionObj();
1413         uo.setName("TestUnion");
1414 
1415         uo.addMember("name", "any");
1416         uo.addMember("age", "std::vector<int>");
1417 
1418         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1419         uol.add(uo);
1420         ParseObj po = new ParseObj();
1421         po.setUnionList(uol);
1422         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1423         gb.genUnionList(po.getUnionList());
1424 
1425         if (gb instanceof GenCHFile gdf) {
1426             String unionContent = gdf.getUnionContent();
1427             System.out.println("genUnion: " + unionContent);
1428             String expect = "\nunion TestUnion{\n" +
1429                     "\tauto name;\n" +
1430                     "\tint* age;\n" +
1431                     "};\n";
1432             assertEquals(expect, unionContent);
1433         }
1434     }
1435 
1436     @Test
genUnionList22()1437     void genUnionList22() {
1438         UnionObj uo = new UnionObj();
1439         uo.setName("TestUnion");
1440 
1441         uo.addMember("name", "any");
1442         uo.addMember("age", "std::queue<int>");
1443 
1444         List<UnionObj> uol = new CopyOnWriteArrayList<>();
1445         uol.add(uo);
1446         ParseObj po = new ParseObj();
1447         po.setUnionList(uol);
1448         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1449         gb.genUnionList(po.getUnionList());
1450 
1451         if (gb instanceof GenCHFile gdf) {
1452             String unionContent = gdf.getUnionContent();
1453             System.out.println("genUnion: " + unionContent);
1454             String expect = "\nunion TestUnion{\n" +
1455                     "\tauto name;\n" +
1456                     "\tint* age;\n" +
1457                     "};\n";
1458             assertEquals(expect, unionContent);
1459         }
1460     }
1461 
1462     @Test
genVarList1()1463     void genVarList1() {
1464         ParseObj po = new ParseObj();
1465         ParamObj pao = new ParamObj();
1466         pao.setName("TestParam");
1467         pao.setType("number");
1468         pao.setStrValue("100");
1469         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1470         pol.add(pao);
1471         po.setVarList(pol);
1472 
1473         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1474         gb.genVarList(pol);
1475 
1476         if (gb instanceof GenCHFile gdf) {
1477             String varContent = gdf.getConstContent();
1478             System.out.println("genVar: " + varContent);
1479             String expect = "\nextends const int TestParam = 100;\n";
1480             assertEquals(expect, varContent);
1481         }
1482     }
1483 
1484     @Test
genVarList2()1485     void genVarList2() {
1486         ParseObj po = new ParseObj();
1487         ParamObj pao = new ParamObj();
1488         pao.setName("TestParam");
1489         pao.setType("long");
1490         pao.setStrValue("100");
1491         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1492         pol.add(pao);
1493         po.setVarList(pol);
1494 
1495         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1496         gb.genVarList(pol);
1497 
1498         if (gb instanceof GenCHFile gdf) {
1499             String varContent = gdf.getConstContent();
1500             System.out.println("genVar: " + varContent);
1501             String expect = "\nextends const long TestParam = 100;\n";
1502             assertEquals(expect, varContent);
1503         }
1504     }
1505 
1506     @Test
genVarList3()1507     void genVarList3() {
1508         ParseObj po = new ParseObj();
1509         ParamObj pao = new ParamObj();
1510         pao.setName("TestParam");
1511         pao.setType("short");
1512         pao.setStrValue("100");
1513         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1514         pol.add(pao);
1515         po.setVarList(pol);
1516 
1517         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1518         gb.genVarList(pol);
1519 
1520         if (gb instanceof GenCHFile gdf) {
1521             String varContent = gdf.getConstContent();
1522             System.out.println("genVar: " + varContent);
1523             String expect = "\nextends const short TestParam = 100;\n";
1524             assertEquals(expect, varContent);
1525         }
1526     }
1527 
1528     @Test
genVarList4()1529     void genVarList4() {
1530         ParseObj po = new ParseObj();
1531         ParamObj pao = new ParamObj();
1532         pao.setName("TestParam");
1533         pao.setType("long long");
1534         pao.setStrValue("100");
1535         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1536         pol.add(pao);
1537         po.setVarList(pol);
1538 
1539         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1540         gb.genVarList(pol);
1541 
1542         if (gb instanceof GenCHFile gdf) {
1543             String varContent = gdf.getConstContent();
1544             System.out.println("genVar: " + varContent);
1545             String expect = "\nextends const long long TestParam = 100;\n";
1546             assertEquals(expect, varContent);
1547         }
1548     }
1549 
1550     @Test
genVarList5()1551     void genVarList5() {
1552         ParseObj po = new ParseObj();
1553         ParamObj pao = new ParamObj();
1554         pao.setName("TestParam");
1555         pao.setType("float");
1556         pao.setStrValue("100");
1557         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1558         pol.add(pao);
1559         po.setVarList(pol);
1560 
1561         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1562         gb.genVarList(pol);
1563 
1564         if (gb instanceof GenCHFile gdf) {
1565             String varContent = gdf.getConstContent();
1566             System.out.println("genVar: " + varContent);
1567             String expect = "\nextends const float TestParam = 100;\n";
1568             assertEquals(expect, varContent);
1569         }
1570     }
1571 
1572     @Test
genVarList6()1573     void genVarList6() {
1574         ParseObj po = new ParseObj();
1575         ParamObj pao = new ParamObj();
1576         pao.setName("TestParam");
1577         pao.setType("double");
1578         pao.setStrValue("100");
1579         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1580         pol.add(pao);
1581         po.setVarList(pol);
1582 
1583         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1584         gb.genVarList(pol);
1585 
1586         if (gb instanceof GenCHFile gdf) {
1587             String varContent = gdf.getConstContent();
1588             System.out.println("genVar: " + varContent);
1589             String expect = "\nextends const double TestParam = 100;\n";
1590             assertEquals(expect, varContent);
1591         }
1592     }
1593 
1594     @Test
genVarList7()1595     void genVarList7() {
1596         ParseObj po = new ParseObj();
1597         ParamObj pao = new ParamObj();
1598         pao.setName("TestParam");
1599         pao.setType("uint8");
1600         pao.setStrValue("100");
1601         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1602         pol.add(pao);
1603         po.setVarList(pol);
1604 
1605         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1606         gb.genVarList(pol);
1607 
1608         if (gb instanceof GenCHFile gdf) {
1609             String varContent = gdf.getConstContent();
1610             System.out.println("genVar: " + varContent);
1611             String expect = "\nextends const uint8 TestParam = 100;\n";
1612             assertEquals(expect, varContent);
1613         }
1614     }
1615 
1616     @Test
genVarList8()1617     void genVarList8() {
1618         ParseObj po = new ParseObj();
1619         ParamObj pao = new ParamObj();
1620         pao.setName("TestParam");
1621         pao.setType("uint16");
1622         pao.setStrValue("100");
1623         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1624         pol.add(pao);
1625         po.setVarList(pol);
1626 
1627         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1628         gb.genVarList(pol);
1629 
1630         if (gb instanceof GenCHFile gdf) {
1631             String varContent = gdf.getConstContent();
1632             System.out.println("genVar: " + varContent);
1633             String expect = "\nextends const uint16 TestParam = 100;\n";
1634             assertEquals(expect, varContent);
1635         }
1636     }
1637 
1638     @Test
genVarList9()1639     void genVarList9() {
1640         ParseObj po = new ParseObj();
1641         ParamObj pao = new ParamObj();
1642         pao.setName("TestParam");
1643         pao.setType("uint32");
1644         pao.setStrValue("100");
1645         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1646         pol.add(pao);
1647         po.setVarList(pol);
1648 
1649         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1650         gb.genVarList(pol);
1651 
1652         if (gb instanceof GenCHFile gdf) {
1653             String varContent = gdf.getConstContent();
1654             System.out.println("genVar: " + varContent);
1655             String expect = "\nextends const uint32 TestParam = 100;\n";
1656             assertEquals(expect, varContent);
1657         }
1658     }
1659 
1660     @Test
genVarList10()1661     void genVarList10() {
1662         ParseObj po = new ParseObj();
1663         ParamObj pao = new ParamObj();
1664         pao.setName("TestParam");
1665         pao.setType("uint64");
1666         pao.setStrValue("100");
1667         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1668         pol.add(pao);
1669         po.setVarList(pol);
1670 
1671         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1672         gb.genVarList(pol);
1673 
1674         if (gb instanceof GenCHFile gdf) {
1675             String varContent = gdf.getConstContent();
1676             System.out.println("genVar: " + varContent);
1677             String expect = "\nextends const uint64 TestParam = 100;\n";
1678             assertEquals(expect, varContent);
1679         }
1680     }
1681 
1682     @Test
genVarList11()1683     void genVarList11() {
1684         ParseObj po = new ParseObj();
1685         ParamObj pao = new ParamObj();
1686         pao.setName("TestParam");
1687         pao.setType("int8");
1688         pao.setStrValue("100");
1689         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1690         pol.add(pao);
1691         po.setVarList(pol);
1692 
1693         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1694         gb.genVarList(pol);
1695 
1696         if (gb instanceof GenCHFile gdf) {
1697             String varContent = gdf.getConstContent();
1698             System.out.println("genVar: " + varContent);
1699             String expect = "\nextends const int8 TestParam = 100;\n";
1700             assertEquals(expect, varContent);
1701         }
1702     }
1703 
1704     @Test
genVarList12()1705     void genVarList12() {
1706         ParseObj po = new ParseObj();
1707         ParamObj pao = new ParamObj();
1708         pao.setName("TestParam");
1709         pao.setType("int16");
1710         pao.setStrValue("100");
1711         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1712         pol.add(pao);
1713         po.setVarList(pol);
1714 
1715         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1716         gb.genVarList(pol);
1717 
1718         if (gb instanceof GenCHFile gdf) {
1719             String varContent = gdf.getConstContent();
1720             System.out.println("genVar: " + varContent);
1721             String expect = "\nextends const int16 TestParam = 100;\n";
1722             assertEquals(expect, varContent);
1723         }
1724     }
1725 
1726     @Test
genVarList13()1727     void genVarList13() {
1728         ParseObj po = new ParseObj();
1729         ParamObj pao = new ParamObj();
1730         pao.setName("TestParam");
1731         pao.setType("int32");
1732         pao.setStrValue("100");
1733         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1734         pol.add(pao);
1735         po.setVarList(pol);
1736 
1737         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1738         gb.genVarList(pol);
1739 
1740         if (gb instanceof GenCHFile gdf) {
1741             String varContent = gdf.getConstContent();
1742             System.out.println("genVar: " + varContent);
1743             String expect = "\nextends const int32 TestParam = 100;\n";
1744             assertEquals(expect, varContent);
1745         }
1746     }
1747 
1748     @Test
genVarList14()1749     void genVarList14() {
1750         ParseObj po = new ParseObj();
1751         ParamObj pao = new ParamObj();
1752         pao.setName("TestParam");
1753         pao.setType("int64");
1754         pao.setStrValue("100");
1755         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1756         pol.add(pao);
1757         po.setVarList(pol);
1758 
1759         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1760         gb.genVarList(pol);
1761 
1762         if (gb instanceof GenCHFile gdf) {
1763             String varContent = gdf.getConstContent();
1764             System.out.println("genVar: " + varContent);
1765             String expect = "\nextends const int64 TestParam = 100;\n";
1766             assertEquals(expect, varContent);
1767         }
1768     }
1769 
1770     @Test
genVarList15()1771     void genVarList15() {
1772         ParseObj po = new ParseObj();
1773         ParamObj pao = new ParamObj();
1774         pao.setName("TestParam");
1775         pao.setType("size_t");
1776         pao.setStrValue("100");
1777         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1778         pol.add(pao);
1779         po.setVarList(pol);
1780 
1781         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1782         gb.genVarList(pol);
1783 
1784         if (gb instanceof GenCHFile gdf) {
1785             String varContent = gdf.getConstContent();
1786             System.out.println("genVar: " + varContent);
1787             String expect = "\nextends const size_t TestParam = 100;\n";
1788             assertEquals(expect, varContent);
1789         }
1790     }
1791 
1792     @Test
genVarList16()1793     void genVarList16() {
1794         ParseObj po = new ParseObj();
1795         ParamObj pao = new ParamObj();
1796         pao.setName("TestParam");
1797         pao.setType("string");
1798         pao.setStrValue("100");
1799         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1800         pol.add(pao);
1801         po.setVarList(pol);
1802 
1803         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1804         gb.genVarList(pol);
1805 
1806         if (gb instanceof GenCHFile gdf) {
1807             String varContent = gdf.getConstContent();
1808             System.out.println("genVar: " + varContent);
1809             String expect = "\nextends const char* TestParam = 100;\n";
1810             assertEquals(expect, varContent);
1811         }
1812     }
1813 
1814     @Test
genVarList17()1815     void genVarList17() {
1816         ParseObj po = new ParseObj();
1817         ParamObj pao = new ParamObj();
1818         pao.setName("TestParam");
1819         pao.setType("std::string");
1820         pao.setStrValue("100");
1821         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1822         pol.add(pao);
1823         po.setVarList(pol);
1824 
1825         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1826         gb.genVarList(pol);
1827 
1828         if (gb instanceof GenCHFile gdf) {
1829             String varContent = gdf.getConstContent();
1830             System.out.println("genVar: " + varContent);
1831             String expect = "\nextends const char* TestParam = 100;\n";
1832             assertEquals(expect, varContent);
1833         }
1834     }
1835 
1836     @Test
genVarList18()1837     void genVarList18() {
1838         ParseObj po = new ParseObj();
1839         ParamObj pao = new ParamObj();
1840         pao.setName("TestParam");
1841         pao.setType("std::array<int>");
1842         pao.setStrValue("100");
1843         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1844         pol.add(pao);
1845         po.setVarList(pol);
1846 
1847         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1848         gb.genVarList(pol);
1849 
1850         if (gb instanceof GenCHFile gdf) {
1851             String varContent = gdf.getConstContent();
1852             System.out.println("genVar: " + varContent);
1853             String expect = "\nextends const int* TestParam = 100;\n";
1854             assertEquals(expect, varContent);
1855         }
1856     }
1857 
1858     @Test
genVarList19()1859     void genVarList19() {
1860         ParseObj po = new ParseObj();
1861         ParamObj pao = new ParamObj();
1862         pao.setName("TestParam");
1863         pao.setType("std::stack<int>");
1864         pao.setStrValue("100");
1865         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1866         pol.add(pao);
1867         po.setVarList(pol);
1868 
1869         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1870         gb.genVarList(pol);
1871 
1872         if (gb instanceof GenCHFile gdf) {
1873             String varContent = gdf.getConstContent();
1874             System.out.println("genVar: " + varContent);
1875             String expect = "\nextends const int* TestParam = 100;\n";
1876             assertEquals(expect, varContent);
1877         }
1878     }
1879 
1880     @Test
genVarList20()1881     void genVarList20() {
1882         ParseObj po = new ParseObj();
1883         ParamObj pao = new ParamObj();
1884         pao.setName("TestParam");
1885         pao.setType("std::vector<int>");
1886         pao.setStrValue("100");
1887         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1888         pol.add(pao);
1889         po.setVarList(pol);
1890 
1891         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1892         gb.genVarList(pol);
1893 
1894         if (gb instanceof GenCHFile gdf) {
1895             String varContent = gdf.getConstContent();
1896             System.out.println("genVar: " + varContent);
1897             String expect = "\nextends const int* TestParam = 100;\n";
1898             assertEquals(expect, varContent);
1899         }
1900     }
1901 
1902 
1903     @Test
genVarList21()1904     void genVarList21() {
1905         ParseObj po = new ParseObj();
1906         ParamObj pao = new ParamObj();
1907         pao.setName("TestParam");
1908         pao.setType("std::queue<int>");
1909         pao.setStrValue("100");
1910         List<ParamObj> pol = new CopyOnWriteArrayList<>();
1911         pol.add(pao);
1912         po.setVarList(pol);
1913 
1914         GeneratorBase gb = GenerateFactory.getGenerator("CH");
1915         gb.genVarList(pol);
1916 
1917         if (gb instanceof GenCHFile gdf) {
1918             String varContent = gdf.getConstContent();
1919             System.out.println("genVar: " + varContent);
1920             String expect = "\nextends const int* TestParam = 100;\n";
1921             assertEquals(expect, varContent);
1922         }
1923     }
1924 }