• 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 parse;
17 
18 import grammar.*;
19 import org.antlr.v4.runtime.CharStreams;
20 import org.antlr.v4.runtime.CodePointCharStream;
21 import org.junit.jupiter.api.Test;
22 import utils.TsToken;
23 
24 import java.util.List;
25 
26 import static org.junit.jupiter.api.Assertions.*;
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 ParseTsTest {
38 
39     String testInterface1 = "export interface CallbackTest {\n" +
40             "\t(msg: string): void;\n" +
41             "};";
42 
43     String testInterface2 = "interface IPerson {\n" +
44             "    name: string;\n" +
45             "}";
46 
47     String testInterface3 = "interface IKeyValueProcessor<T, U>\n" +
48             "{\n" +
49             "    process(key: T, val: U): void;\n" +
50             "};";
51 
52     String testInterface4 = "interface IProcessor\n" +
53             "{\n" +
54             "    result:T;\n" +
55             "    process(a: T, b: T) => T;\n" +
56             "}";
57 
58     String testInterface5 = "interface KeyPair<T, U> {\n" +
59             "    key: T;\n" +
60             "    value: U;\n" +
61             "}";
62 
63     String testInterface6 = "interface KeyValueProcessor<T, U>\n" +
64             "{\n" +
65             "    (key: T, val: U): void;\n" +
66             "};";
67 
68     String testInterface7 = "export interface IPerson {\n" +
69             "    name: string;\n" +
70             "    gender: string;\n" +
71             "}";
72 
73     String testInterface8 = "interface IEmployee extends IPerson{\n" +
74             "    empCode: number;\n" +
75             "    readonly empName: string;\n" +
76             "    empDept?:string;\n" +
77             "    getSalary: (number) => number; // arrow function\n" +
78             "    getManagerName(number): string;\n" +
79             "}";
80 
81     String testInterface9 = "declare interface IRouteInfo {\n" +
82             "    path: string;\n" +
83             "    title: string;\n" +
84             "    icon: string;\n" +
85             "    class: string;\n" +
86             "    allowAnonymous: boolean;\n" +
87             "}";
88 
89     String testInterface10 = "interface KeyPair {\n" +
90             "    key: number;\n" +
91             "    value: string;\n" +
92             "}\n";
93 
94     String testInterface11 = "interface NumList {\n" +
95             "    [index:string]:string\n" +
96             "}";
97 
98     String testInterface12 = "interface IStringList {\n" +
99             "    [index:string]:string\n" +
100             "}";
101 
102     String testFunc2 = "namespace StringUtility\n" +
103             "{\n" +
104             "    function ToCapital(str: string): string {\n" +
105             "        return str.toUpperCase();\n" +
106             "    }\n" +
107             "\n" +
108             "    function Nemw(str: string, length: number = 0): string {\n" +
109             "        return str.toUpperCase();\n" +
110             "    }\n" +
111             "    export function Eported(from: string, length: number = 0): string {\n" +
112             "        return from.toUpperCase();\n" +
113             "    }\n" +
114             "\n" +
115             "    export function Eported2(str: string, length: number = 0): string {\n" +
116             "        return str.toUpperCase();\n" +
117             "    }\n" +
118             "}";
119 
120     String testFunc3 = "function Sum(x: number, y: number) : void {\n" +
121             "    console.log('processNumKeyPairs: key = ' + key + ', value = ' + value)\n" +
122             "    return x + y;\n" +
123             "}";
124 
125     String testFunc4 = "let greeting = function() {\n" +
126             "    console.log(\"Hello TypeScript!\");\n" +
127             "};";
128 
129     String testFunc5 = "let SumAnon = function(x: number, y: number) : number\n" +
130             "{\n" +
131             "    return x + y;\n" +
132             "}";
133 
134     String testFunc6 = "function Greet(greeting: string, name?: string ) : string {\n" +
135             "    return greeting + ' ' + name + '!';\n" +
136             "}";
137 
138     String testFunc7 = "function terminateJob(jobId: string) {\n" +
139             "    return this.http.delete<IOperationResult<any>>();\n" +
140             "}";
141 
142     String testFunc8 = "function Greet2(name: string, greeting: string = \"Hello\") : string {\n" +
143             "    return greeting + ' ' + name + '!';\n" +
144             "}";
145 
146     String testFunc9 = "Greet(undefined, 'Steve');";
147 
148     String testFunc10 = "let sumArrow = (x: number, y: number): number => {\n" +
149             "    return x + y\n" +
150             "}";
151 
152     String testFunc11 = "let Print = () => console.log(\"Hello TypeScript\");";
153 
154     String testFunc12 = "let sumShortArrow = (x: number, y: number) => x + y;";
155 
156     String testFunc13 = "function Greet(greeting: string, ...names: string[]) {\n" +
157             "    return greeting + \" \" + names.join(\", \") + \"!\";\n" +
158             "}";
159 
160     String testFunc14 = "function Test(value: TestClass | TestClass2): value is TestClass {\n" +
161             "    return (<TestClass>value).someFunction !== undefined;\n" +
162             "}";
163 
164     String testFunc15 = "function buildName(firstName: string, lastName?: string) {\n" +
165             "    if (lastName) return firstName + \" \" + lastName;\n" +
166             "    else return firstName;\n" +
167             "  }";
168 
169     String testFunc16 = "// Try passing a nested type to the function. " +
170             " This tests we don't match \">>\" and \">>>\" operators\n" +
171             "// when closing nested types.\n" +
172             "function nestedType(map: Map<string, Map<string, Set<string>>>) {\n" +
173             "    // Check that we can parse these too.\n" +
174             "    let a = 12;\n" +
175             "    let b = a >> 5;\n" +
176             "    let c = b >>> 5;\n" +
177             "}";
178 
179     String testFunc17 = "// Function parameter lists can have a trailing comma.\n" +
180             "// See https://github.com/Microsoft/TypeScript/issues/16152\n" +
181             "function TrailingComma(arg1: string, arg2: number,) {}";
182 
183     String testFunc18 = "var myFunction = function(arg1: string, arg2: number,) {};";
184 
185     String testFunc19 = "function getArray<T>(items : T[] ) : T[] {\n" +
186             "    return new Array<T>().concat();\n" +
187             "}";
188 
189     String testFunc20 = "let myNumArr = getArray<Test>([100, 200, 300]);";
190 
191     String testFunc21 = "let myStrArr = getArray<string>([\"Hello\", \"World\"]);";
192 
193     String testFunc22 = "function displayType<T, U>(id:T, name:U): void {\n" +
194             "    console.log(typeof(id) + \", \" + typeof(name));\n" +
195             "}";
196 
197     String testFunc23 = "function displayTypeNon<T>(id:T, name:string): void {\n" +
198             "    console.log(typeof(id) + \", \" + typeof(name));\n" +
199             "}";
200 
201     String testFunc24 = "function displayNames<T>(names:T[]): void {\n" +
202             "    console.log(names.join(\", \"));\n" +
203             "}";
204 
205     String testFunc25 = "function display<T extends Person>(per: T): void {\n" +
206             "    console.log(`${ per.firstName} ${per.lastName}` );\n" +
207             "}";
208 
209     String testFunc26 = "function genericWithKeyOf<T, K extends keyof T>(list: T[], field: K): T[] {}";
210 
211     String testFunc27 = "function genericParameterWithDefault<T = DefaultType>(field: T) {}";
212 
213     String testFunc28 = "function processNumKeyPairs(key:number, value:number):void {\n" +
214             "    console.log('processNumKeyPairs: key = ' + key + ', value = ' + value)\n" +
215             "}";
216 
217     String testFunc29 = "function processEntity(e?: Entity) {\n" +
218             "  let s = e!.name;\n" +
219             "  let t = e.name;\n" +
220             "  let o = e!.obj!.i;\n" +
221             "  let p = e?.name;\n" +
222             "\n" +
223             "  let i = p!;\n" +
224             "}";
225 
226     String testFunc30 = "export const AsyncTaskReturnVoid: () => Promise<object>;";
227 
228     String testFunc31 = "export const AsyncTaskLongLongFunctionReturnLong: (min: number, max: number, " +
229             "func: (a: number, b: number, c: string) => number) => Promise<number>;";
230 
231     String testFunc32 = "export const AsyncTaskLongReturnLong: (a: number) => Promise<number>;";
232 
233     String testFunc33 = "export const CallbackInvoke: (func: () => void) => void;";
234 
235     String testFunc34 = "export const CallbackInvokeFromThread: (func: () => void) => void;";
236 
237     String testFunc35 = "export const CallbackReturnVoid: (func: () => void) => void;";
238 
239     String testFunc36 = "export const SafetyCallbackReturnVoid: (func: () => void) => void;";
240 
241     String testFunc37 = "export const CallbackReturnBool_True: (func: (value: boolean) => boolean) => boolean;";
242 
243     String testFunc38 = "export const SafetyCallbackReturnBool_True: (func: (value: boolean) => boolean) => boolean;";
244 
245     String testFunc39 = "export const CallbackReturnInt_Int: (func: (value: number) => number) => number;";
246 
247     String testFunc40 = "export const CallbackReturnString_String: (func: (value: string) => string) => string;";
248 
249     String testFunc41 = "export const SafetyCallbackReturnString_String: (func: (value: string) => string) => string;";
250 
251     String testFunc42 = "export const CallbackReturnDouble_Double: (func: (value: number) => number) => number;";
252 
253     String testFunc43 = "export const SafetyCallbackReturnDouble_Double: " +
254             "(func: (value: number) => number) => number;";
255 
256     String testFunc44 = "export const SafetyCallbackReturnDouble_Double_Num_X2: " +
257             "(func: (value: number) => number) => number;";
258 
259     String testType2 = "// TypeAlias\n" +
260             "type Employee = {\n" +
261             "     type: \"employee\" | \"manager\";\n" +
262             "     typeId: 1 | 2;\n" +
263             "     id: string;\n" +
264             "     name: string;\n" +
265             "     address?: string; // Optional\n" +
266             "     phone?: string | null;\n" +
267             "}";
268 
269     String testType3 = "type EmployeeType =\n" +
270             "     | \"employee\"\n" +
271             "     | \"manager\";";
272 
273     String testType4 = "type EmployeeNameType = Employee[\"name\"];";
274 
275     String testType5 = "type EmployeeMap = Map<string, string>;";
276 
277     String testType6 = "type EmployeeMapKey = keyof EmployeeMap;";
278 
279     String testVariable1 = "let employeeName = \"John\";";
280 
281     String testVariable2 = "let employeeName:string = \"John\";";
282 
283     String testVariable3 = "var num1:number = 1;";
284 
285     String testVariable4 = "const playerCodes = {\n" +
286             "    player1 : 9,\n" +
287             "    player2 : 10,\n" +
288             "    player3 : 13,\n" +
289             "    player4 : 20\n" +
290             "};\n" +
291             "playerCodes.player2 = 11; // OK";
292 
293     String testVariable5 = "playerCodes = {     " +
294             "//Compiler Error: Cannot assign to playerCodes because it is a constant or read-only\n" +
295             "    player1 : 50,   // Modified value\n" +
296             "    player2 : 10,\n" +
297             "    player3 : 13,\n" +
298             "    player4 : 20\n" +
299             "};";
300 
301     String testVariable6 = "playerCodesArray = {     " +
302         "//Compiler Error: Cannot assign to playerCodes because it is a constant or read-only\n" +
303         "    player1 : 50,   // Modified value\n" +
304         "    player2 : playerCodes[Test],\n" +
305         "    player3 : 13,\n" +
306         "    player4 : 20\n" +
307         "};";
308 
309     String testVariable7 = "export const ROUTES: any[] = [\n" +
310         "{path: '/dashboard', title: 'Dashboard', icon: 'dashboard', class: '', allowAnonymous: false},\n" +
311         "{path: '/deals', title: 'Deals', icon: 'assignment', class: '', allowAnonymous: false},\n" +
312         "{path: '/pipeline', title: 'Pipeline', icon: 'timeline', class: '', allowAnonymous: false},\n" +
313         "{path: '/language-resolver', title: 'Language', icon: 'translate', class: '', allowAnonymous: false},\n" +
314         "{path: '/commit-analysis', title: 'Commit History', icon: 'tune', class: '', allowAnonymous: false},\n" +
315         "{path: '/login', title: 'Log In', icon: 'lock', class: '', allowAnonymous: true},\n" +
316         "];";
317 
318     String testVariable8 = "export const Components = _.chain([_.values(ROUTES) as any[]])\n" +
319             "       .flatten()\n" +
320             "       .filter((item) => item.name && (item.name.toLowerCase().endsWith('component')))\n" +
321             "       .value();";
322 
323     String testVariable9 = "var fileLanguages = " +
324             "_.uniqBy([...this.fileLanguages, ...Components], p => p.fileId);";
325 
326     String testVariable10 = "var languageMap = " +
327             "new Map(fileLanguages.map(lang => [lang.id, lang] as [string, ILanguage]));";
328 
329     String testVariable11 = "let schema = mapEnumToSchema(Joi.boolean())";
330 
331     String testVariable12 = "const codesByType = Joi.object()\n" +
332             "  .keys({\n" +
333             "    type: Joi.string().required(),\n" +
334             "    limit: Joi.number().optional(),\n" +
335             "    skip: Joi.number().optional(),\n" +
336             "  })\n" +
337             "  .required();";
338 
339     String testVariable13 = "const post = (...args: any[]) => {\n" +
340             "};";
341 
342     String testVariable14 = "const function = ([x]: any) => x;";
343 
344     @Test
parseFile()345     void parseFile() {
346     }
347 
348     @Test
parseContent()349     void parseContent() {
350     }
351 
352     @Test
parseCStreamEnum()353     void parseCStreamEnum() {
354         ParseBase parser = ParseFactory.getParser("ts2cpp");
355         String testEnum = "enum Colors {\n" +
356                 "  Red = \"RED\",\n" +
357                 "  Green = \"GREEN\",\n" +
358                 "  Blue = \"BLUE\"\n" +
359                 "}";
360         CodePointCharStream cStream = CharStreams.fromString(testEnum);
361         ParseObj po = parser.parseCStream(cStream);
362         List<EnumObj> eol = po.getEnumList();
363         assertEquals(1, eol.size());
364         EnumObj eo = eol.get(0);
365         assertEquals("Colors", eo.getName());
366         List<String> ml = eo.getMemberList();
367         assertEquals(3, ml.size());
368         assertEquals("Red", ml.get(0));
369         assertEquals("Green", ml.get(1));
370         assertEquals("Blue", ml.get(2));
371         List<String> vl = eo.getValueList();
372         assertEquals(3, vl.size());
373         assertEquals("\"RED\"", vl.get(0));
374         assertEquals("\"GREEN\"", vl.get(1));
375         assertEquals("\"BLUE\"", vl.get(2));
376     }
377 
378     @Test
parseCStreamFunc_1()379     void parseCStreamFunc_1() {
380         ParseBase parser = ParseFactory.getParser("ts2cpp");
381         String testFunc = "export function transform2D(\n" +
382                 "\tdirection: number,\n" +
383                 "\tangle: number,\n" +
384                 "\tcalcCB: Calculate): boolean;";
385         CodePointCharStream cStream = CharStreams.fromString(testFunc);
386         ParseObj po = parser.parseCStream(cStream);
387         List<FuncObj> fol = po.getFuncList();
388         assertEquals(1, fol.size());
389         FuncObj fo = fol.get(0);
390         assertEquals("transform2D", fo.getName());
391         assertEquals("boolean", fo.getRetValue());
392         List<ParamObj> pol = fo.getParamList();
393         assertEquals(3, pol.size());
394         ParamObj poItem = pol.get(0);
395         assertEquals("direction", poItem.getName());
396         assertEquals("number", poItem.getType());
397         poItem = pol.get(1);
398         assertEquals("angle", poItem.getName());
399         assertEquals("number", poItem.getType());
400         poItem = pol.get(2);
401         assertEquals("calcCB", poItem.getName());
402         assertEquals("Calculate", poItem.getType());
403     }
404 
405     @Test
parseCStreamFunc_2()406     void parseCStreamFunc_2() {
407         ParseBase parser = ParseFactory.getParser("ts2cpp");
408         String testFunc = testFunc2;
409         CodePointCharStream cStream = CharStreams.fromString(testFunc);
410         ParseObj po = parser.parseCStream(cStream);
411         List<FuncObj> fol = po.getFuncList();
412         assertEquals(4, fol.size());
413         FuncObj fo = fol.get(0);
414         assertEquals("ToCapital", fo.getName());
415         assertEquals("string", fo.getRetValue());
416         List<ParamObj> pol = fo.getParamList();
417         assertEquals(1, pol.size());
418         ParamObj poItem = pol.get(0);
419         assertEquals("str", poItem.getName());
420         assertEquals("string", poItem.getType());
421 
422         fo = fol.get(1);
423         assertEquals("Nemw", fo.getName());
424         assertEquals("string", fo.getRetValue());
425         pol = fo.getParamList();
426         assertEquals(2, pol.size());
427         poItem = pol.get(0);
428         assertEquals("str", poItem.getName());
429         assertEquals("string", poItem.getType());
430         poItem = pol.get(1);
431         assertEquals("length", poItem.getName());
432         assertEquals("number", poItem.getType());
433 
434         fo = fol.get(2);
435         assertEquals("Eported", fo.getName());
436         assertEquals("string", fo.getRetValue());
437         pol = fo.getParamList();
438         assertEquals(2, pol.size());
439         poItem = pol.get(0);
440         assertEquals("from", poItem.getName());
441         assertEquals("string", poItem.getType());
442         poItem = pol.get(1);
443         assertEquals("length", poItem.getName());
444         assertEquals("number", poItem.getType());
445 
446         fo = fol.get(3);
447         assertEquals("Eported2", fo.getName());
448         assertEquals("string", fo.getRetValue());
449         pol = fo.getParamList();
450         assertEquals(2, pol.size());
451         poItem = pol.get(0);
452         assertEquals("str", poItem.getName());
453         assertEquals("string", poItem.getType());
454         poItem = pol.get(1);
455         assertEquals("length", poItem.getName());
456         assertEquals("number", poItem.getType());
457     }
458 
459     @Test
parseCStreamFunc_3()460     void parseCStreamFunc_3() {
461         ParseBase parser = ParseFactory.getParser("ts2cpp");
462         String testFunc = testFunc3;
463         CodePointCharStream cStream = CharStreams.fromString(testFunc);
464         ParseObj po = parser.parseCStream(cStream);
465         List<FuncObj> fol = po.getFuncList();
466         assertEquals(1, fol.size());
467         assertEquals("Sum", fol.get(0).getName());
468         assertEquals("void", fol.get(0).getRetValue());
469         List<ParamObj> pol = fol.get(0).getParamList();
470         assertEquals(2, pol.size());
471         assertEquals("x", pol.get(0).getName());
472         assertEquals("number", pol.get(0).getType());
473         assertEquals("y", pol.get(1).getName());
474         assertEquals("number", pol.get(1).getType());
475     }
476 
477     @Test
parseCStreamFunc_4()478     void parseCStreamFunc_4() {
479         ParseBase parser = ParseFactory.getParser("ts2cpp");
480         String testFunc = testFunc4;
481         CodePointCharStream cStream = CharStreams.fromString(testFunc);
482         ParseObj po = parser.parseCStream(cStream);
483         List<FuncObj> fol = po.getFuncList();
484         assertEquals(1, fol.size());
485         assertEquals("greeting", fol.get(0).getAlias());
486         assertEquals("void", fol.get(0).getRetValue());
487         List<ParamObj> pol = fol.get(0).getParamList();
488         assertEquals(0, pol.size());
489     }
490 
491     @Test
parseCStreamFunc_5()492     void parseCStreamFunc_5() {
493         ParseBase parser = ParseFactory.getParser("ts2cpp");
494         String testFunc = testFunc5;
495         CodePointCharStream cStream = CharStreams.fromString(testFunc);
496         ParseObj po = parser.parseCStream(cStream);
497         List<FuncObj> fol = po.getFuncList();
498         assertEquals(1, fol.size());
499         assertEquals("SumAnon", fol.get(0).getAlias());
500         assertEquals("void", fol.get(0).getRetValue());
501         List<ParamObj> pol = fol.get(0).getParamList();
502         assertEquals(2, pol.size());
503         assertEquals("x", pol.get(0).getName());
504         assertEquals("number", pol.get(0).getType());
505         assertEquals("y", pol.get(1).getName());
506         assertEquals("number", pol.get(1).getType());
507     }
508 
509     @Test
parseCStreamFunc_6()510     void parseCStreamFunc_6() {
511         ParseBase parser = ParseFactory.getParser("ts2cpp");
512         String testFunc = testFunc6;
513         CodePointCharStream cStream = CharStreams.fromString(testFunc);
514         ParseObj po = parser.parseCStream(cStream);
515         List<FuncObj> fol = po.getFuncList();
516         assertEquals(1, fol.size());
517         assertEquals("Greet", fol.get(0).getName());
518         assertEquals("string", fol.get(0).getRetValue());
519         List<ParamObj> pol = fol.get(0).getParamList();
520         assertEquals(2, pol.size());
521         assertEquals("greeting", pol.get(0).getName());
522         assertEquals("string", pol.get(0).getType());
523         assertEquals("name", pol.get(1).getName());
524         assertEquals("string", pol.get(1).getType());
525         assertEquals(TsToken.TS_TOKEN_OPTIONAL, pol.get(1).getDecorator());
526     }
527 
528     @Test
parseCStreamFunc_7()529     void parseCStreamFunc_7() {
530         ParseBase parser = ParseFactory.getParser("ts2cpp");
531         String testFunc = testFunc7;
532         CodePointCharStream cStream = CharStreams.fromString(testFunc);
533         ParseObj po = parser.parseCStream(cStream);
534         List<FuncObj> fol = po.getFuncList();
535         assertEquals(1, fol.size());
536         assertEquals("terminateJob", fol.get(0).getName());
537         assertEquals("void", fol.get(0).getRetValue());
538         List<ParamObj> pol = fol.get(0).getParamList();
539         assertEquals(1, pol.size());
540         assertEquals("jobId", pol.get(0).getName());
541         assertEquals("string", pol.get(0).getType());
542 
543     }
544 
545     @Test
parseCStreamFunc_8()546     void parseCStreamFunc_8() {
547         ParseBase parser = ParseFactory.getParser("ts2cpp");
548         String testFunc = testFunc8;
549         CodePointCharStream cStream = CharStreams.fromString(testFunc);
550         ParseObj po = parser.parseCStream(cStream);
551         List<FuncObj> fol = po.getFuncList();
552         assertEquals(1, fol.size());
553         assertEquals("Greet2", fol.get(0).getName());
554         assertEquals("string", fol.get(0).getRetValue());
555         List<ParamObj> pol = fol.get(0).getParamList();
556         assertEquals(2, pol.size());
557         assertEquals("name", pol.get(0).getName());
558         assertEquals("string", pol.get(0).getType());
559         assertEquals("greeting", pol.get(1).getName());
560         assertEquals("string", pol.get(1).getType());
561     }
562 
563     @Test
parseCStreamFunc_9()564     void parseCStreamFunc_9() {
565         ParseBase parser = ParseFactory.getParser("ts2cpp");
566         String testFunc = testFunc9;
567         CodePointCharStream cStream = CharStreams.fromString(testFunc);
568         ParseObj po = parser.parseCStream(cStream);
569         List<FuncObj> fol = po.getFuncList();
570         assertEquals(1, fol.size());
571         assertEquals("Greet", fol.get(0).getAlias());
572         assertEquals("void", fol.get(0).getRetValue());
573         List<ParamObj> pol = fol.get(0).getParamList();
574         assertEquals(2, pol.size());
575         assertEquals("undefined", pol.get(0).getName());
576         assertEquals("", pol.get(0).getType());
577         assertEquals("'Steve'", pol.get(1).getName());
578         assertEquals("", pol.get(1).getType());
579     }
580 
581     @Test
parseCStreamFunc_10()582     void parseCStreamFunc_10() {
583         ParseBase parser = ParseFactory.getParser("ts2cpp");
584         String testFunc = testFunc10;
585         CodePointCharStream cStream = CharStreams.fromString(testFunc);
586         ParseObj po = parser.parseCStream(cStream);
587         List<FuncObj> fol = po.getFuncList();
588         assertEquals(1, fol.size());
589         assertEquals("sumArrow", fol.get(0).getAlias());
590         assertEquals("void", fol.get(0).getRetValue());
591         List<ParamObj> pol = fol.get(0).getParamList();
592         assertEquals(2, pol.size());
593         assertEquals("x", pol.get(0).getName());
594         assertEquals("number", pol.get(0).getType());
595         assertEquals("y", pol.get(1).getName());
596         assertEquals("number", pol.get(1).getType());
597     }
598 
599     @Test
parseCStreamFunc_11()600     void parseCStreamFunc_11() {
601         ParseBase parser = ParseFactory.getParser("ts2cpp");
602         String testFunc = testFunc11;
603         CodePointCharStream cStream = CharStreams.fromString(testFunc);
604         ParseObj po = parser.parseCStream(cStream);
605         List<FuncObj> fol = po.getFuncList();
606         assertEquals(1, fol.size());
607         List<ParamObj> pol = fol.get(0).getParamList();
608         assertEquals(0, pol.size());
609     }
610 
611     @Test
parseCStreamFunc_12()612     void parseCStreamFunc_12() {
613         ParseBase parser = ParseFactory.getParser("ts2cpp");
614         String testFunc = testFunc12;
615         CodePointCharStream cStream = CharStreams.fromString(testFunc);
616         ParseObj po = parser.parseCStream(cStream);
617         List<FuncObj> fol = po.getFuncList();
618         assertEquals(1, fol.size());
619         assertEquals("sumShortArrow", fol.get(0).getAlias());
620         assertEquals("void", fol.get(0).getRetValue());
621         List<ParamObj> pol = fol.get(0).getParamList();
622         assertEquals(2, pol.size());
623         assertEquals("x", pol.get(0).getName());
624         assertEquals("number", pol.get(0).getType());
625         assertEquals("y", pol.get(1).getName());
626         assertEquals("number", pol.get(1).getType());
627     }
628 
629     @Test
parseCStreamFunc_13()630     void parseCStreamFunc_13() {
631         ParseBase parser = ParseFactory.getParser("ts2cpp");
632         String testFunc = testFunc13;
633         CodePointCharStream cStream = CharStreams.fromString(testFunc);
634         ParseObj po = parser.parseCStream(cStream);
635         List<FuncObj> fol = po.getFuncList();
636         assertEquals(1, fol.size());
637         assertEquals("Greet", fol.get(0).getName());
638         assertEquals("void", fol.get(0).getRetValue());
639         List<ParamObj> pol = fol.get(0).getParamList();
640         assertEquals(2, pol.size());
641         assertEquals("greeting", pol.get(0).getName());
642         assertEquals("string", pol.get(0).getType());
643         assertEquals("names", pol.get(1).getName());
644         assertEquals("string[]", pol.get(1).getType());
645         assertEquals(TsToken.TS_TOKEN_REST_PARAM, pol.get(1).getDecorator());
646     }
647 
648     @Test
parseCStreamFunc_14()649     void parseCStreamFunc_14() {
650         ParseBase parser = ParseFactory.getParser("ts2cpp");
651         String testFunc = testFunc14;
652         CodePointCharStream cStream = CharStreams.fromString(testFunc);
653         ParseObj po = parser.parseCStream(cStream);
654         List<FuncObj> fol = po.getFuncList();
655         assertEquals(1, fol.size());
656         assertEquals("Test", fol.get(0).getName());
657         assertEquals("boolean", fol.get(0).getRetValue());
658         List<ParamObj> pol = fol.get(0).getParamList();
659         assertEquals(1, pol.size());
660         assertEquals("value", pol.get(0).getName());
661         assertEquals("TestClass|TestClass2", pol.get(0).getType());
662 
663     }
664 
665     @Test
parseCStreamFunc_15()666     void parseCStreamFunc_15() {
667         ParseBase parser = ParseFactory.getParser("ts2cpp");
668         String testFunc = testFunc15;
669         CodePointCharStream cStream = CharStreams.fromString(testFunc);
670         ParseObj po = parser.parseCStream(cStream);
671         List<FuncObj> fol = po.getFuncList();
672         assertEquals(1, fol.size());
673         assertEquals("buildName", fol.get(0).getName());
674         assertEquals("void", fol.get(0).getRetValue());
675         List<ParamObj> pol = fol.get(0).getParamList();
676         assertEquals(2, pol.size());
677         assertEquals("firstName", pol.get(0).getName());
678         assertEquals("string", pol.get(0).getType());
679         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
680         assertEquals("lastName", pol.get(1).getName());
681         assertEquals("string", pol.get(1).getType());
682         assertEquals(TsToken.TS_TOKEN_OPTIONAL, pol.get(1).getDecorator());
683     }
684 
685     @Test
parseCStreamFunc_16()686     void parseCStreamFunc_16() {
687         ParseBase parser = ParseFactory.getParser("ts2cpp");
688         String testFunc = testFunc16;
689         CodePointCharStream cStream = CharStreams.fromString(testFunc);
690         ParseObj po = parser.parseCStream(cStream);
691         List<FuncObj> fol = po.getFuncList();
692         assertEquals(1, fol.size());
693         assertEquals("nestedType", fol.get(0).getName());
694         assertEquals("void", fol.get(0).getRetValue());
695         List<ParamObj> pol = fol.get(0).getParamList();
696         assertEquals(1, pol.size());
697         assertEquals("map", pol.get(0).getName());
698         assertEquals("Map<string,Map<string,Set<string>>>", pol.get(0).getType());
699     }
700 
701     @Test
parseCStreamFunc_17()702     void parseCStreamFunc_17() {
703         ParseBase parser = ParseFactory.getParser("ts2cpp");
704         String testFunc = testFunc17;
705         CodePointCharStream cStream = CharStreams.fromString(testFunc);
706         ParseObj po = parser.parseCStream(cStream);
707         List<FuncObj> fol = po.getFuncList();
708         assertEquals(1, fol.size());
709         assertEquals("TrailingComma", fol.get(0).getName());
710         assertEquals("void", fol.get(0).getRetValue());
711         List<ParamObj> pol = fol.get(0).getParamList();
712         assertEquals(2, pol.size());
713         assertEquals("arg1", pol.get(0).getName());
714         assertEquals("string", pol.get(0).getType());
715         assertEquals("arg2", pol.get(1).getName());
716         assertEquals("number", pol.get(1).getType());
717     }
718 
719     @Test
parseCStreamFunc_18()720     void parseCStreamFunc_18() {
721         ParseBase parser = ParseFactory.getParser("ts2cpp");
722         String testFunc = testFunc18;
723         CodePointCharStream cStream = CharStreams.fromString(testFunc);
724         ParseObj po = parser.parseCStream(cStream);
725         List<FuncObj> fol = po.getFuncList();
726         assertEquals(1, fol.size());
727         assertEquals("myFunction", fol.get(0).getAlias());
728         assertEquals("void", fol.get(0).getRetValue());
729         List<ParamObj> pol = fol.get(0).getParamList();
730         assertEquals(2, pol.size());
731         assertEquals("arg1", pol.get(0).getName());
732         assertEquals("string", pol.get(0).getType());
733         assertEquals("arg2", pol.get(1).getName());
734         assertEquals("number", pol.get(1).getType());
735     }
736 
737     @Test
parseCStreamFunc_19()738     void parseCStreamFunc_19() {
739         ParseBase parser = ParseFactory.getParser("ts2cpp");
740         String testFunc = testFunc19;
741         CodePointCharStream cStream = CharStreams.fromString(testFunc);
742         ParseObj po = parser.parseCStream(cStream);
743         List<FuncObj> fol = po.getFuncList();
744         assertEquals(1, fol.size());
745         assertEquals("getArray", fol.get(0).getName());
746         assertEquals("T[]", fol.get(0).getRetValue());
747         List<ParamObj> pol = fol.get(0).getParamList();
748         assertEquals(1, pol.size());
749         assertEquals("items", pol.get(0).getName());
750         assertEquals("T[]", pol.get(0).getType());
751     }
752 
753     @Test
parseCStreamFunc_20()754     void parseCStreamFunc_20() {
755         ParseBase parser = ParseFactory.getParser("ts2cpp");
756         String testFunc = testFunc20;
757         CodePointCharStream cStream = CharStreams.fromString(testFunc);
758         ParseObj po = parser.parseCStream(cStream);
759         List<FuncObj> fol = po.getFuncList();
760         assertEquals(1, fol.size());
761         assertEquals("getArray", fol.get(0).getName());
762         assertEquals("myNumArr", fol.get(0).getAlias());
763         assertEquals("void", fol.get(0).getRetValue());
764         assertEquals("<Test>", fol.get(0).getTemplate(0));
765         List<ParamObj> pol = fol.get(0).getParamList();
766         assertEquals(1, pol.size());
767         assertEquals("[100,200,300]", pol.get(0).getStrValue(0));
768 
769     }
770 
771     @Test
parseCStreamFunc_21()772     void parseCStreamFunc_21() {
773         ParseBase parser = ParseFactory.getParser("ts2cpp");
774         String testFunc = testFunc21;
775         CodePointCharStream cStream = CharStreams.fromString(testFunc);
776         ParseObj po = parser.parseCStream(cStream);
777         List<FuncObj> fol = po.getFuncList();
778         assertEquals(1, fol.size());
779         assertEquals("getArray", fol.get(0).getName());
780         assertEquals("myStrArr", fol.get(0).getAlias());
781         assertEquals("void", fol.get(0).getRetValue());
782         List<ParamObj> pol = fol.get(0).getParamList();
783         assertEquals(1, pol.size());
784         assertEquals("[\"Hello\",\"World\"]", pol.get(0).getStrValue(0));
785 
786     }
787 
788     @Test
parseCStreamFunc_22()789     void parseCStreamFunc_22() {
790         ParseBase parser = ParseFactory.getParser("ts2cpp");
791         String testFunc = testFunc22;
792         CodePointCharStream cStream = CharStreams.fromString(testFunc);
793         ParseObj po = parser.parseCStream(cStream);
794         List<FuncObj> fol = po.getFuncList();
795         assertEquals(1, fol.size());
796         assertEquals("displayType", fol.get(0).getName());
797         assertEquals("T", fol.get(0).getTemplate(0));
798         assertEquals("U", fol.get(0).getTemplate(1));
799         assertEquals("void", fol.get(0).getRetValue());
800         List<ParamObj> pol = fol.get(0).getParamList();
801         assertEquals(2, pol.size());
802         assertEquals("id", pol.get(0).getName());
803         assertEquals("T", pol.get(0).getType());
804         assertEquals("name", pol.get(1).getName());
805         assertEquals("U", pol.get(1).getType());
806     }
807 
808     @Test
parseCStreamFunc_23()809     void parseCStreamFunc_23() {
810         ParseBase parser = ParseFactory.getParser("ts2cpp");
811         String testFunc = testFunc23;
812         CodePointCharStream cStream = CharStreams.fromString(testFunc);
813         ParseObj po = parser.parseCStream(cStream);
814         List<FuncObj> fol = po.getFuncList();
815         assertEquals(1, fol.size());
816         assertEquals("displayTypeNon", fol.get(0).getName());
817         assertEquals("T", fol.get(0).getTemplate(0));
818         assertEquals("void", fol.get(0).getRetValue());
819         List<ParamObj> pol = fol.get(0).getParamList();
820         assertEquals(2, pol.size());
821         assertEquals("id", pol.get(0).getName());
822         assertEquals("T", pol.get(0).getType());
823         assertEquals("name", pol.get(1).getName());
824         assertEquals("string", pol.get(1).getType());
825     }
826 
827     @Test
parseCStreamFunc_24()828     void parseCStreamFunc_24() {
829         ParseBase parser = ParseFactory.getParser("ts2cpp");
830         String testFunc = testFunc24;
831         CodePointCharStream cStream = CharStreams.fromString(testFunc);
832         ParseObj po = parser.parseCStream(cStream);
833         List<FuncObj> fol = po.getFuncList();
834         assertEquals(1, fol.size());
835         assertEquals("displayNames", fol.get(0).getName());
836         assertEquals("T", fol.get(0).getTemplate(0));
837         assertEquals("void", fol.get(0).getRetValue());
838         List<ParamObj> pol = fol.get(0).getParamList();
839         assertEquals(1, pol.size());
840         assertEquals("names", pol.get(0).getName());
841         assertEquals("T[]", pol.get(0).getType());
842     }
843 
844     @Test
parseCStreamFunc_25()845     void parseCStreamFunc_25() {
846         ParseBase parser = ParseFactory.getParser("ts2cpp");
847         String testFunc = testFunc25;
848         CodePointCharStream cStream = CharStreams.fromString(testFunc);
849         ParseObj po = parser.parseCStream(cStream);
850         List<FuncObj> fol = po.getFuncList();
851         assertEquals(1, fol.size());
852         assertEquals("display", fol.get(0).getName());
853         assertEquals("T", fol.get(0).getTemplate(0));
854         assertEquals("void", fol.get(0).getRetValue());
855         List<ParamObj> pol = fol.get(0).getParamList();
856         assertEquals(1, pol.size());
857         assertEquals("per", pol.get(0).getName());
858         assertEquals("T", pol.get(0).getType());
859     }
860 
861     @Test
parseCStreamFunc_26()862     void parseCStreamFunc_26() {
863         ParseBase parser = ParseFactory.getParser("ts2cpp");
864         String testFunc = testFunc26;
865         CodePointCharStream cStream = CharStreams.fromString(testFunc);
866         ParseObj po = parser.parseCStream(cStream);
867         List<FuncObj> fol = po.getFuncList();
868         assertEquals(1, fol.size());
869         assertEquals("genericWithKeyOf", fol.get(0).getName());
870         assertEquals("T", fol.get(0).getTemplate(0));
871         assertEquals("K", fol.get(0).getTemplate(1));
872         assertEquals("T[]", fol.get(0).getRetValue());
873         List<ParamObj> pol = fol.get(0).getParamList();
874         assertEquals(2, pol.size());
875         assertEquals("list", pol.get(0).getName());
876         assertEquals("T[]", pol.get(0).getType());
877         assertEquals("field", pol.get(1).getName());
878         assertEquals("K", pol.get(1).getType());
879     }
880 
881     @Test
parseCStreamFunc_27()882     void parseCStreamFunc_27() {
883         ParseBase parser = ParseFactory.getParser("ts2cpp");
884         String testFunc = testFunc27;
885         CodePointCharStream cStream = CharStreams.fromString(testFunc);
886         ParseObj po = parser.parseCStream(cStream);
887         List<FuncObj> fol = po.getFuncList();
888         assertEquals(1, fol.size());
889         assertEquals("genericParameterWithDefault", fol.get(0).getName());
890         assertEquals("T", fol.get(0).getTemplate(0));
891         assertEquals("void", fol.get(0).getRetValue());
892         List<ParamObj> pol = fol.get(0).getParamList();
893         assertEquals(1, pol.size());
894         assertEquals("field", pol.get(0).getName());
895         assertEquals("T", pol.get(0).getType());
896     }
897 
898     @Test
parseCStreamFunc_28()899     void parseCStreamFunc_28() {
900         ParseBase parser = ParseFactory.getParser("ts2cpp");
901         String testFunc = testFunc28;
902         CodePointCharStream cStream = CharStreams.fromString(testFunc);
903         ParseObj po = parser.parseCStream(cStream);
904         List<FuncObj> fol = po.getFuncList();
905         assertEquals(1, fol.size());
906         assertEquals("processNumKeyPairs", fol.get(0).getName());
907         assertEquals("void", fol.get(0).getRetValue());
908         List<ParamObj> pol = fol.get(0).getParamList();
909         assertEquals(2, pol.size());
910         assertEquals("key", pol.get(0).getName());
911         assertEquals("number", pol.get(0).getType());
912         assertEquals("value", pol.get(1).getName());
913         assertEquals("number", pol.get(1).getType());
914     }
915 
916     @Test
parseCStreamFunc_29()917     void parseCStreamFunc_29() {
918         ParseBase parser = ParseFactory.getParser("ts2cpp");
919         String testFunc = testFunc29;
920         CodePointCharStream cStream = CharStreams.fromString(testFunc);
921         ParseObj po = parser.parseCStream(cStream);
922         List<FuncObj> fol = po.getFuncList();
923         assertEquals(1, fol.size());
924         assertEquals("processEntity", fol.get(0).getName());
925         assertEquals("void", fol.get(0).getRetValue());
926         List<ParamObj> pol = fol.get(0).getParamList();
927         assertEquals(1, pol.size());
928         assertEquals("e", pol.get(0).getName());
929         assertEquals("Entity", pol.get(0).getType());
930         assertEquals(TsToken.TS_TOKEN_OPTIONAL, pol.get(0).getDecorator());
931     }
932 
933     @Test
parseCStreamFunc_30()934     void parseCStreamFunc_30() {
935         ParseBase parser = ParseFactory.getParser("ts2cpp");
936         String testFunc = testFunc30;
937         CodePointCharStream cStream = CharStreams.fromString(testFunc);
938         ParseObj po = parser.parseCStream(cStream);
939         List<FuncObj> fol = po.getFuncList();
940         assertEquals(1, fol.size());
941         assertEquals("AsyncTaskReturnVoid", fol.get(0).getName());
942         assertEquals("Promise<object>", fol.get(0).getRetValue());
943         List<ParamObj> pol = fol.get(0).getParamList();
944         assertEquals(0, pol.size());
945 
946     }
947 
948     @Test
parseCStreamFunc_31()949     void parseCStreamFunc_31() {
950         ParseBase parser = ParseFactory.getParser("ts2cpp");
951         String testFunc = testFunc31;
952         CodePointCharStream cStream = CharStreams.fromString(testFunc);
953         ParseObj po = parser.parseCStream(cStream);
954         List<FuncObj> fol = po.getFuncList();
955         assertEquals(1, fol.size());
956         assertEquals("AsyncTaskLongLongFunctionReturnLong", fol.get(0).getName());
957         assertEquals("Promise<number>", fol.get(0).getRetValue());
958         List<ParamObj> pol = fol.get(0).getParamList();
959         assertEquals(3, pol.size());
960         assertEquals("min", pol.get(0).getName());
961         assertEquals("number", pol.get(0).getType());
962         assertEquals("max", pol.get(1).getName());
963         assertEquals("number", pol.get(1).getType());
964         assertEquals("func", pol.get(2).getName());
965         assertEquals("(a:number,b:number,c:string)=>number", pol.get(2).getType());
966         assertEquals("number", pol.get(2).getFoList().get(0).getRetValue());
967         assertEquals("a", pol.get(2).getFoList().get(0).getParamList().get(0).getName());
968         assertEquals("number", pol.get(2).getFoList().get(0).getParamList().get(0).getType());
969         assertEquals("b", pol.get(2).getFoList().get(0).getParamList().get(1).getName());
970         assertEquals("number", pol.get(2).getFoList().get(0).getParamList().get(1).getType());
971         assertEquals("c", pol.get(2).getFoList().get(0).getParamList().get(2).getName());
972         assertEquals("string", pol.get(2).getFoList().get(0).getParamList().get(2).getType());
973         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
974     }
975 
976     @Test
parseCStreamFunc_32()977     void parseCStreamFunc_32() {
978         ParseBase parser = ParseFactory.getParser("ts2cpp");
979         String testFunc = testFunc32;
980         CodePointCharStream cStream = CharStreams.fromString(testFunc);
981         ParseObj po = parser.parseCStream(cStream);
982         List<FuncObj> fol = po.getFuncList();
983         assertEquals(1, fol.size());
984         assertEquals("AsyncTaskLongReturnLong", fol.get(0).getName());
985         assertEquals("Promise<number>", fol.get(0).getRetValue());
986         List<ParamObj> pol = fol.get(0).getParamList();
987         assertEquals(1, pol.size());
988         assertEquals("a", pol.get(0).getName());
989         assertEquals("number", pol.get(0).getType());
990         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
991     }
992 
993     @Test
parseCStreamFunc_33()994     void parseCStreamFunc_33() {
995         ParseBase parser = ParseFactory.getParser("ts2cpp");
996         String testFunc = testFunc33;
997         CodePointCharStream cStream = CharStreams.fromString(testFunc);
998         ParseObj po = parser.parseCStream(cStream);
999         List<FuncObj> fol = po.getFuncList();
1000         assertEquals(1, fol.size());
1001         assertEquals("CallbackInvoke", fol.get(0).getName());
1002         assertEquals("void", fol.get(0).getRetValue());
1003         List<ParamObj> pol = fol.get(0).getParamList();
1004         assertEquals(1, pol.size());
1005         assertEquals("func", pol.get(0).getName());
1006         assertEquals("()=>void", pol.get(0).getType());
1007         assertEquals("void", pol.get(0).getFoList().get(0).getRetValue());
1008         assertEquals(0, pol.get(0).getFoList().get(0).getParamList().size());
1009         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1010     }
1011 
1012     @Test
parseCStreamFunc_34()1013     void parseCStreamFunc_34() {
1014         ParseBase parser = ParseFactory.getParser("ts2cpp");
1015         String testFunc = testFunc34;
1016         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1017         ParseObj po = parser.parseCStream(cStream);
1018         List<FuncObj> fol = po.getFuncList();
1019         assertEquals(1, fol.size());
1020         assertEquals("CallbackInvokeFromThread", fol.get(0).getName());
1021         assertEquals("void", fol.get(0).getRetValue());
1022         List<ParamObj> pol = fol.get(0).getParamList();
1023         assertEquals(1, pol.size());
1024         assertEquals("func", pol.get(0).getName());
1025         assertEquals("()=>void", pol.get(0).getType());
1026         assertEquals("void", pol.get(0).getFoList().get(0).getRetValue());
1027         assertEquals(0, pol.get(0).getFoList().get(0).getParamList().size());
1028         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1029     }
1030 
1031     @Test
parseCStreamFunc_35()1032     void parseCStreamFunc_35() {
1033         ParseBase parser = ParseFactory.getParser("ts2cpp");
1034         String testFunc = testFunc35;
1035         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1036         ParseObj po = parser.parseCStream(cStream);
1037         List<FuncObj> fol = po.getFuncList();
1038         assertEquals(1, fol.size());
1039         assertEquals("CallbackReturnVoid", fol.get(0).getName());
1040         assertEquals("void", fol.get(0).getRetValue());
1041         List<ParamObj> pol = fol.get(0).getParamList();
1042         assertEquals(1, pol.size());
1043         assertEquals("func", pol.get(0).getName());
1044         assertEquals("()=>void", pol.get(0).getType());
1045         assertEquals("void", pol.get(0).getFoList().get(0).getRetValue());
1046         assertEquals(0, pol.get(0).getFoList().get(0).getParamList().size());
1047         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1048     }
1049 
1050     @Test
parseCStreamFunc_36()1051     void parseCStreamFunc_36() {
1052         ParseBase parser = ParseFactory.getParser("ts2cpp");
1053         String testFunc = testFunc36;
1054         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1055         ParseObj po = parser.parseCStream(cStream);
1056         List<FuncObj> fol = po.getFuncList();
1057         assertEquals(1, fol.size());
1058         assertEquals("SafetyCallbackReturnVoid", fol.get(0).getName());
1059         assertEquals("void", fol.get(0).getRetValue());
1060         List<ParamObj> pol = fol.get(0).getParamList();
1061         assertEquals(1, pol.size());
1062         assertEquals("func", pol.get(0).getName());
1063         assertEquals("()=>void", pol.get(0).getType());
1064         assertEquals("void", pol.get(0).getFoList().get(0).getRetValue());
1065         assertEquals(0, pol.get(0).getFoList().get(0).getParamList().size());
1066         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1067     }
1068 
1069     @Test
parseCStreamFunc_37()1070     void parseCStreamFunc_37() {
1071         ParseBase parser = ParseFactory.getParser("ts2cpp");
1072         String testFunc = testFunc37;
1073         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1074         ParseObj po = parser.parseCStream(cStream);
1075         List<FuncObj> fol = po.getFuncList();
1076         assertEquals(1, fol.size());
1077         assertEquals("CallbackReturnBool_True", fol.get(0).getName());
1078         assertEquals("boolean", fol.get(0).getRetValue());
1079         List<ParamObj> pol = fol.get(0).getParamList();
1080         assertEquals(1, pol.size());
1081         assertEquals("func", pol.get(0).getName());
1082         assertEquals("(value:boolean)=>boolean", pol.get(0).getType());
1083         assertEquals("boolean", pol.get(0).getFoList().get(0).getRetValue());
1084         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1085         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1086         assertEquals("boolean", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1087         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1088     }
1089 
1090     @Test
parseCStreamFunc_38()1091     void parseCStreamFunc_38() {
1092         ParseBase parser = ParseFactory.getParser("ts2cpp");
1093         String testFunc = testFunc38;
1094         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1095         ParseObj po = parser.parseCStream(cStream);
1096         List<FuncObj> fol = po.getFuncList();
1097         assertEquals(1, fol.size());
1098         assertEquals("SafetyCallbackReturnBool_True", fol.get(0).getName());
1099         assertEquals("boolean", fol.get(0).getRetValue());
1100         List<ParamObj> pol = fol.get(0).getParamList();
1101         assertEquals(1, pol.size());
1102         assertEquals("func", pol.get(0).getName());
1103         assertEquals("(value:boolean)=>boolean", pol.get(0).getType());
1104         assertEquals("boolean", pol.get(0).getFoList().get(0).getRetValue());
1105         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1106         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1107         assertEquals("boolean", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1108         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1109     }
1110 
1111     @Test
parseCStreamFunc_39()1112     void parseCStreamFunc_39() {
1113         ParseBase parser = ParseFactory.getParser("ts2cpp");
1114         String testFunc = testFunc39;
1115         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1116         ParseObj po = parser.parseCStream(cStream);
1117         List<FuncObj> fol = po.getFuncList();
1118         assertEquals(1, fol.size());
1119         assertEquals("CallbackReturnInt_Int", fol.get(0).getName());
1120         assertEquals("number", fol.get(0).getRetValue());
1121         List<ParamObj> pol = fol.get(0).getParamList();
1122         assertEquals(1, pol.size());
1123         assertEquals("func", pol.get(0).getName());
1124         assertEquals("(value:number)=>number", pol.get(0).getType());
1125         assertEquals("number", pol.get(0).getFoList().get(0).getRetValue());
1126         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1127         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1128         assertEquals("number", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1129         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1130     }
1131 
1132     @Test
parseCStreamFunc_40()1133     void parseCStreamFunc_40() {
1134         ParseBase parser = ParseFactory.getParser("ts2cpp");
1135         String testFunc = testFunc40;
1136         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1137         ParseObj po = parser.parseCStream(cStream);
1138         List<FuncObj> fol = po.getFuncList();
1139         assertEquals(1, fol.size());
1140         assertEquals("CallbackReturnString_String", fol.get(0).getName());
1141         assertEquals("string", fol.get(0).getRetValue());
1142         List<ParamObj> pol = fol.get(0).getParamList();
1143         assertEquals(1, pol.size());
1144         assertEquals("func", pol.get(0).getName());
1145         assertEquals("(value:string)=>string", pol.get(0).getType());
1146         assertEquals("string", pol.get(0).getFoList().get(0).getRetValue());
1147         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1148         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1149         assertEquals("string", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1150         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1151     }
1152 
1153     @Test
parseCStreamFunc_41()1154     void parseCStreamFunc_41() {
1155         ParseBase parser = ParseFactory.getParser("ts2cpp");
1156         String testFunc = testFunc41;
1157         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1158         ParseObj po = parser.parseCStream(cStream);
1159         List<FuncObj> fol = po.getFuncList();
1160         assertEquals(1, fol.size());
1161         assertEquals("SafetyCallbackReturnString_String", fol.get(0).getName());
1162         assertEquals("string", fol.get(0).getRetValue());
1163         List<ParamObj> pol = fol.get(0).getParamList();
1164         assertEquals(1, pol.size());
1165         assertEquals("func", pol.get(0).getName());
1166         assertEquals("(value:string)=>string", pol.get(0).getType());
1167         assertEquals("string", pol.get(0).getFoList().get(0).getRetValue());
1168         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1169         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1170         assertEquals("string", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1171         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1172     }
1173 
1174     @Test
parseCStreamFunc_42()1175     void parseCStreamFunc_42() {
1176         ParseBase parser = ParseFactory.getParser("ts2cpp");
1177         String testFunc = testFunc42;
1178         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1179         ParseObj po = parser.parseCStream(cStream);
1180         List<FuncObj> fol = po.getFuncList();
1181         assertEquals(1, fol.size());
1182         assertEquals("CallbackReturnDouble_Double", fol.get(0).getName());
1183         assertEquals("number", fol.get(0).getRetValue());
1184         List<ParamObj> pol = fol.get(0).getParamList();
1185         assertEquals(1, pol.size());
1186         assertEquals("func", pol.get(0).getName());
1187         assertEquals("(value:number)=>number", pol.get(0).getType());
1188         assertEquals("number", pol.get(0).getFoList().get(0).getRetValue());
1189         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1190         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1191         assertEquals("number", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1192         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1193     }
1194 
1195     @Test
parseCStreamFunc_43()1196     void parseCStreamFunc_43() {
1197         ParseBase parser = ParseFactory.getParser("ts2cpp");
1198         String testFunc = testFunc43;
1199         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1200         ParseObj po = parser.parseCStream(cStream);
1201         List<FuncObj> fol = po.getFuncList();
1202         assertEquals(1, fol.size());
1203         assertEquals("SafetyCallbackReturnDouble_Double", fol.get(0).getName());
1204         assertEquals("number", fol.get(0).getRetValue());
1205         List<ParamObj> pol = fol.get(0).getParamList();
1206         assertEquals(1, pol.size());
1207         assertEquals("func", pol.get(0).getName());
1208         assertEquals("(value:number)=>number", pol.get(0).getType());
1209         assertEquals("number", pol.get(0).getFoList().get(0).getRetValue());
1210         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1211         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1212         assertEquals("number", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1213         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1214     }
1215 
1216     @Test
parseCStreamFunc_44()1217     void parseCStreamFunc_44() {
1218         ParseBase parser = ParseFactory.getParser("ts2cpp");
1219         String testFunc = testFunc44;
1220         CodePointCharStream cStream = CharStreams.fromString(testFunc);
1221         ParseObj po = parser.parseCStream(cStream);
1222         List<FuncObj> fol = po.getFuncList();
1223         assertEquals(1, fol.size());
1224         assertEquals("SafetyCallbackReturnDouble_Double_Num_X2", fol.get(0).getName());
1225         assertEquals("number", fol.get(0).getRetValue());
1226         List<ParamObj> pol = fol.get(0).getParamList();
1227         assertEquals(1, pol.size());
1228         assertEquals("func", pol.get(0).getName());
1229         assertEquals("(value:number)=>number", pol.get(0).getType());
1230         assertEquals("number", pol.get(0).getFoList().get(0).getRetValue());
1231         assertEquals(1, pol.get(0).getFoList().get(0).getParamList().size());
1232         assertEquals("value", pol.get(0).getFoList().get(0).getParamList().get(0).getName());
1233         assertEquals("number", pol.get(0).getFoList().get(0).getParamList().get(0).getType());
1234         assertEquals(TsToken.TS_TOKEN_REQUIRED, pol.get(0).getDecorator());
1235     }
1236 
1237     @Test
parseCStreamInterface()1238     void parseCStreamInterface() {
1239         ParseBase parser = ParseFactory.getParser("ts2cpp");
1240         String testInterface = testInterface1;
1241         CodePointCharStream cStream = CharStreams.fromString(testInterface);
1242         ParseObj po = parser.parseCStream(cStream);
1243         List<InterfaceObject> iol = po.getInterfaceList();
1244         assertEquals(1, iol.size());
1245         InterfaceObject ioItem = iol.get(0);
1246         List<FuncObj> fol = ioItem.getFuncList();
1247         assertEquals(1, fol.size());
1248         FuncObj foItem = fol.get(0);
1249         assertEquals("", foItem.getName());
1250         assertEquals("void", foItem.getRetValue());
1251         List<ParamObj> pol = foItem.getParamList();
1252         assertEquals(1, pol.size());
1253         ParamObj poItem = pol.get(0);
1254         assertEquals("msg", poItem.getName());
1255         assertEquals("string", poItem.getType());
1256     }
1257 
1258     @Test
parseCStreamType1()1259     void parseCStreamType1() {
1260         ParseBase parser = ParseFactory.getParser("ts2cpp");
1261         String testType = "export type TestShap_t = TestShape;";
1262         CodePointCharStream cStream = CharStreams.fromString(testType);
1263         ParseObj po = parser.parseCStream(cStream);
1264         List<TypeObj> tol = po.getTypeList();
1265         assertEquals(1, tol.size());
1266         TypeObj toItem = tol.get(0);
1267         assertEquals("TestShap_t", toItem.getName());
1268         List<String> tl = toItem.getTypeList();
1269         assertEquals(1, tl.size());
1270         assertEquals("TestShape", tl.get(0));
1271     }
1272 
1273     @Test
parseCStreamType2()1274     void parseCStreamType2() {
1275         ParseBase parser = ParseFactory.getParser("ts2cpp");
1276         String testType = testType2;
1277         CodePointCharStream cStream = CharStreams.fromString(testType);
1278         ParseObj po = parser.parseCStream(cStream);
1279         List<TypeObj> tol = po.getTypeList();
1280         assertEquals(1, tol.size());
1281         TypeObj toItem = tol.get(0);
1282         assertEquals("Employee", toItem.getName());
1283         List<ParamObj> pal = toItem.getParamList();
1284         assertEquals(6, pal.size());
1285         assertEquals("type", pal.get(0).getName());
1286         assertEquals("\"employee\"", pal.get(0).getStrValue(0));
1287         assertEquals("\"manager\"", pal.get(0).getStrValue(1));
1288         assertEquals("typeId", pal.get(1).getName());
1289         assertEquals("1", pal.get(1).getStrValue(0));
1290         assertEquals("2", pal.get(1).getStrValue(1));
1291         assertEquals("id", pal.get(2).getName());
1292         assertEquals("string", pal.get(2).getType());
1293         assertEquals("name", pal.get(3).getName());
1294         assertEquals("string", pal.get(3).getType());
1295         assertEquals("address", pal.get(4).getName());
1296         assertEquals("string", pal.get(4).getType());
1297         assertEquals("phone", pal.get(5).getName());
1298         assertEquals("string", pal.get(5).getType());
1299     }
1300 
1301     @Test
parseCStreamType3()1302     void parseCStreamType3() {
1303         ParseBase parser = ParseFactory.getParser("ts2cpp");
1304         String testType = testType3;
1305         CodePointCharStream cStream = CharStreams.fromString(testType);
1306         ParseObj po = parser.parseCStream(cStream);
1307         List<TypeObj> tol = po.getTypeList();
1308         assertEquals(1, tol.size());
1309         TypeObj toItem = tol.get(0);
1310         assertEquals("EmployeeType", toItem.getName());
1311         assertEquals("\"employee\"", toItem.getParamList().get(0).getStrValue(0));
1312         assertEquals("\"manager\"", toItem.getParamList().get(0).getStrValue(1));
1313 
1314     }
1315 
1316     @Test
parseCStreamType4()1317     void parseCStreamType4() {
1318         ParseBase parser = ParseFactory.getParser("ts2cpp");
1319         String testType = testType4;
1320         CodePointCharStream cStream = CharStreams.fromString(testType);
1321         ParseObj po = parser.parseCStream(cStream);
1322         List<TypeObj> tol = po.getTypeList();
1323         assertEquals(1, tol.size());
1324         TypeObj toItem = tol.get(0);
1325         assertEquals("EmployeeNameType", toItem.getName());
1326         assertEquals("Employee[\"name\"]", toItem.getTypeList().get(0));
1327 
1328     }
1329 
1330     @Test
parseCStreamType5()1331     void parseCStreamType5() {
1332         ParseBase parser = ParseFactory.getParser("ts2cpp");
1333         String testType = testType5;
1334         CodePointCharStream cStream = CharStreams.fromString(testType);
1335         ParseObj po = parser.parseCStream(cStream);
1336         List<TypeObj> tol = po.getTypeList();
1337         assertEquals(1, tol.size());
1338         TypeObj toItem = tol.get(0);
1339         assertEquals("EmployeeMap", toItem.getName());
1340         assertEquals("Map<string,string>", toItem.getTypeList().get(0));
1341 
1342     }
1343 
1344     @Test
parseCStreamType6()1345     void parseCStreamType6() {
1346         ParseBase parser = ParseFactory.getParser("ts2cpp");
1347         String testType = testType6;
1348         CodePointCharStream cStream = CharStreams.fromString(testType);
1349         ParseObj po = parser.parseCStream(cStream);
1350         List<TypeObj> tol = po.getTypeList();
1351         assertEquals(1, tol.size());
1352         TypeObj toItem = tol.get(0);
1353         assertEquals("EmployeeMapKey", toItem.getName());
1354         assertEquals("keyofEmployeeMap", toItem.getTypeList().get(0));
1355 
1356     }
1357 
1358     @Test
parseCStreamConst1()1359     void parseCStreamConst1() {
1360         ParseBase parser = ParseFactory.getParser("ts2cpp");
1361         String testType = testVariable1;
1362         CodePointCharStream cStream = CharStreams.fromString(testType);
1363         ParseObj po = parser.parseCStream(cStream);
1364         List<ParamObj> vol = po.getVarList();
1365         assertEquals(1, vol.size());
1366         ParamObj voItem = vol.get(0);
1367         assertEquals("employeeName", voItem.getName());
1368         assertEquals("\"John\"", voItem.getStrValue(0));
1369     }
1370 
1371     @Test
parseCStreamConst2()1372     void parseCStreamConst2() {
1373         ParseBase parser = ParseFactory.getParser("ts2cpp");
1374         String testType = testVariable2;
1375         CodePointCharStream cStream = CharStreams.fromString(testType);
1376         ParseObj po = parser.parseCStream(cStream);
1377         List<ParamObj> vol = po.getVarList();
1378         assertEquals(1, vol.size());
1379         ParamObj voItem = vol.get(0);
1380         assertEquals("employeeName", voItem.getName());
1381         assertEquals("string", voItem.getType());
1382         assertEquals("\"John\"", voItem.getStrValue(0));
1383     }
1384 
1385     @Test
parseCStreamConst3()1386     void parseCStreamConst3() {
1387         ParseBase parser = ParseFactory.getParser("ts2cpp");
1388         String testType = testVariable3;
1389         CodePointCharStream cStream = CharStreams.fromString(testType);
1390         ParseObj po = parser.parseCStream(cStream);
1391         List<ParamObj> vol = po.getVarList();
1392         assertEquals(1, vol.size());
1393         ParamObj voItem = vol.get(0);
1394         assertEquals("num1", voItem.getName());
1395         assertEquals("number", voItem.getType());
1396         assertEquals("1", voItem.getStrValue(0));
1397     }
1398 
1399     @Test
parseCStreamConst4()1400     void parseCStreamConst4() {
1401         ParseBase parser = ParseFactory.getParser("ts2cpp");
1402         String testType = testVariable4;
1403         CodePointCharStream cStream = CharStreams.fromString(testType);
1404         ParseObj po = parser.parseCStream(cStream);
1405         List<ParamObj> vol = po.getVarList();
1406         assertEquals(2, vol.size());
1407         ParamObj voItem = vol.get(0);
1408         assertEquals("playerCodes", voItem.getName());
1409         assertEquals("player1", voItem.getPaList().get(0).getName());
1410         assertEquals("9", voItem.getPaList().get(0).getStrValue(0));
1411         assertEquals("player2", voItem.getPaList().get(1).getName());
1412         assertEquals("10", voItem.getPaList().get(1).getStrValue(0));
1413         assertEquals("player3", voItem.getPaList().get(2).getName());
1414         assertEquals("13", voItem.getPaList().get(2).getStrValue(0));
1415         assertEquals("player4", voItem.getPaList().get(3).getName());
1416         assertEquals("20", voItem.getPaList().get(3).getStrValue(0));
1417 
1418         ParamObj voItem1 = vol.get(1);
1419         assertEquals("playerCodes.player2", voItem1.getName());
1420         assertEquals("11", voItem1.getStrValue(0));
1421     }
1422 
1423     @Test
parseCStreamConst5()1424     void parseCStreamConst5() {
1425         ParseBase parser = ParseFactory.getParser("ts2cpp");
1426         String testType = testVariable5;
1427         CodePointCharStream cStream = CharStreams.fromString(testType);
1428         ParseObj po = parser.parseCStream(cStream);
1429         List<ParamObj> vol = po.getVarList();
1430         assertEquals(1, vol.size());
1431         ParamObj voItem = vol.get(0);
1432         assertEquals("playerCodes", voItem.getName());
1433         assertEquals("player1", voItem.getPaList().get(0).getName());
1434         assertEquals("50", voItem.getPaList().get(0).getStrValue(0));
1435         assertEquals("player2", voItem.getPaList().get(1).getName());
1436         assertEquals("10", voItem.getPaList().get(1).getStrValue(0));
1437         assertEquals("player3", voItem.getPaList().get(2).getName());
1438         assertEquals("13", voItem.getPaList().get(2).getStrValue(0));
1439         assertEquals("player4", voItem.getPaList().get(3).getName());
1440         assertEquals("20", voItem.getPaList().get(3).getStrValue(0));
1441     }
1442 
1443     @Test
parseCStreamConst6()1444     void parseCStreamConst6() {
1445         ParseBase parser = ParseFactory.getParser("ts2cpp");
1446         String testType = testVariable6;
1447         CodePointCharStream cStream = CharStreams.fromString(testType);
1448         ParseObj po = parser.parseCStream(cStream);
1449         List<ParamObj> vol = po.getVarList();
1450         assertEquals(1, vol.size());
1451         ParamObj voItem = vol.get(0);
1452         assertEquals("playerCodesArray", voItem.getName());
1453         assertEquals("player1", voItem.getPaList().get(0).getName());
1454         assertEquals("50", voItem.getPaList().get(0).getStrValue(0));
1455         assertEquals("player2", voItem.getPaList().get(1).getName());
1456         assertEquals("playerCodes[Test]", voItem.getPaList().get(1).getStrValue(0));
1457         assertEquals("player3", voItem.getPaList().get(2).getName());
1458         assertEquals("13", voItem.getPaList().get(2).getStrValue(0));
1459         assertEquals("player4", voItem.getPaList().get(3).getName());
1460         assertEquals("20", voItem.getPaList().get(3).getStrValue(0));
1461     }
1462 
1463     @Test
parseCStreamConst7_1()1464     void parseCStreamConst7_1() {
1465         ParseBase parser = ParseFactory.getParser("ts2cpp");
1466         String testType = testVariable7;
1467         CodePointCharStream cStream = CharStreams.fromString(testType);
1468         ParseObj po = parser.parseCStream(cStream);
1469         List<ParamObj> vol = po.getVarList();
1470         assertEquals(1, vol.size());
1471         ParamObj voItem = vol.get(0);
1472         assertEquals("ROUTES", voItem.getName());
1473         assertEquals("any[]", voItem.getType());
1474         List<ParamObj> paList = voItem.getPaList();
1475         assertEquals(6, paList.size());
1476 
1477         assertEquals("path", paList.get(0).getPaList().get(0).getName());
1478         assertEquals("title", paList.get(0).getPaList().get(1).getName());
1479         assertEquals("icon", paList.get(0).getPaList().get(2).getName());
1480         assertEquals("class", paList.get(0).getPaList().get(3).getName());
1481         assertEquals("allowAnonymous", paList.get(0).getPaList().get(4).getName());
1482         assertEquals("'/dashboard'", paList.get(0).getPaList().get(0).getStrValue(0));
1483         assertEquals("'Dashboard'", paList.get(0).getPaList().get(1).getStrValue(0));
1484         assertEquals("'dashboard'", paList.get(0).getPaList().get(2).getStrValue(0));
1485         assertEquals("''", paList.get(0).getPaList().get(3).getStrValue(0));
1486         assertEquals("false", paList.get(0).getPaList().get(4).getStrValue(0));
1487 
1488         assertEquals("path", paList.get(1).getPaList().get(0).getName());
1489         assertEquals("title", paList.get(1).getPaList().get(1).getName());
1490         assertEquals("icon", paList.get(1).getPaList().get(2).getName());
1491         assertEquals("class", paList.get(1).getPaList().get(3).getName());
1492         assertEquals("allowAnonymous", paList.get(1).getPaList().get(4).getName());
1493         assertEquals("'/deals'", paList.get(1).getPaList().get(0).getStrValue(0));
1494         assertEquals("'Deals'", paList.get(1).getPaList().get(1).getStrValue(0));
1495         assertEquals("'assignment'", paList.get(1).getPaList().get(2).getStrValue(0));
1496         assertEquals("''", paList.get(1).getPaList().get(3).getStrValue(0));
1497         assertEquals("false", paList.get(1).getPaList().get(4).getStrValue(0));
1498 
1499         assertEquals("path", paList.get(2).getPaList().get(0).getName());
1500         assertEquals("title", paList.get(2).getPaList().get(1).getName());
1501         assertEquals("icon", paList.get(2).getPaList().get(2).getName());
1502         assertEquals("class", paList.get(2).getPaList().get(3).getName());
1503         assertEquals("allowAnonymous", paList.get(2).getPaList().get(4).getName());
1504         assertEquals("'/pipeline'", paList.get(2).getPaList().get(0).getStrValue(0));
1505         assertEquals("'Pipeline'", paList.get(2).getPaList().get(1).getStrValue(0));
1506         assertEquals("'timeline'", paList.get(2).getPaList().get(2).getStrValue(0));
1507         assertEquals("''", paList.get(2).getPaList().get(3).getStrValue(0));
1508         assertEquals("false", paList.get(2).getPaList().get(4).getStrValue(0));
1509     }
1510 
1511     @Test
parseCStreamConst7_2()1512     void parseCStreamConst7_2() {
1513         ParseBase parser = ParseFactory.getParser("ts2cpp");
1514         String testType = testVariable7;
1515         CodePointCharStream cStream = CharStreams.fromString(testType);
1516         ParseObj po = parser.parseCStream(cStream);
1517         List<ParamObj> vol = po.getVarList();
1518         assertEquals(1, vol.size());
1519         ParamObj voItem = vol.get(0);
1520         assertEquals("ROUTES", voItem.getName());
1521         assertEquals("any[]", voItem.getType());
1522         List<ParamObj> paList = voItem.getPaList();
1523         assertEquals(6, paList.size());
1524 
1525         assertEquals("path", paList.get(3).getPaList().get(0).getName());
1526         assertEquals("title", paList.get(3).getPaList().get(1).getName());
1527         assertEquals("icon", paList.get(3).getPaList().get(2).getName());
1528         assertEquals("class", paList.get(3).getPaList().get(3).getName());
1529         assertEquals("allowAnonymous", paList.get(3).getPaList().get(4).getName());
1530         assertEquals("'/language-resolver'", paList.get(3).getPaList().get(0).getStrValue(0));
1531         assertEquals("'Language'", paList.get(3).getPaList().get(1).getStrValue(0));
1532         assertEquals("'translate'", paList.get(3).getPaList().get(2).getStrValue(0));
1533         assertEquals("''", paList.get(3).getPaList().get(3).getStrValue(0));
1534         assertEquals("false", paList.get(3).getPaList().get(4).getStrValue(0));
1535 
1536         assertEquals("path", paList.get(4).getPaList().get(0).getName());
1537         assertEquals("title", paList.get(4).getPaList().get(1).getName());
1538         assertEquals("icon", paList.get(4).getPaList().get(2).getName());
1539         assertEquals("class", paList.get(4).getPaList().get(3).getName());
1540         assertEquals("allowAnonymous", paList.get(4).getPaList().get(4).getName());
1541         assertEquals("'/commit-analysis'", paList.get(4).getPaList().get(0).getStrValue(0));
1542         assertEquals("'Commit History'", paList.get(4).getPaList().get(1).getStrValue(0));
1543         assertEquals("'tune'", paList.get(4).getPaList().get(2).getStrValue(0));
1544         assertEquals("''", paList.get(4).getPaList().get(3).getStrValue(0));
1545         assertEquals("false", paList.get(4).getPaList().get(4).getStrValue(0));
1546 
1547         assertEquals("path", paList.get(5).getPaList().get(0).getName());
1548         assertEquals("title", paList.get(5).getPaList().get(1).getName());
1549         assertEquals("icon", paList.get(5).getPaList().get(2).getName());
1550         assertEquals("class", paList.get(5).getPaList().get(3).getName());
1551         assertEquals("allowAnonymous", paList.get(5).getPaList().get(4).getName());
1552         assertEquals("'/login'", paList.get(5).getPaList().get(0).getStrValue(0));
1553         assertEquals("'Log In'", paList.get(5).getPaList().get(1).getStrValue(0));
1554         assertEquals("'lock'", paList.get(5).getPaList().get(2).getStrValue(0));
1555         assertEquals("''", paList.get(5).getPaList().get(3).getStrValue(0));
1556         assertEquals("true", paList.get(5).getPaList().get(4).getStrValue(0));
1557     }
1558 
1559     @Test
parseCStreamConst8()1560     void parseCStreamConst8() {
1561         ParseBase parser = ParseFactory.getParser("ts2cpp");
1562         String testType = testVariable8;
1563         CodePointCharStream cStream = CharStreams.fromString(testType);
1564         ParseObj po = parser.parseCStream(cStream);
1565         List<ParamObj> vol = po.getVarList();
1566         assertEquals(1, vol.size());
1567         ParamObj voItem = vol.get(0);
1568         assertEquals("Components", voItem.getName());
1569         assertEquals("_.chain([_.values(ROUTES)asany[]]).flatten()." +
1570                 "filter((item)=>item.name&&(item.name.toLowerCase().endsWith('component')))." +
1571                 "value", voItem.getStrValue(0));
1572     }
1573 
1574     @Test
parseCStreamConst9()1575     void parseCStreamConst9() {
1576         ParseBase parser = ParseFactory.getParser("ts2cpp");
1577         String testType = testVariable9;
1578         CodePointCharStream cStream = CharStreams.fromString(testType);
1579         ParseObj po = parser.parseCStream(cStream);
1580         List<ParamObj> vol = po.getVarList();
1581         assertEquals(1, vol.size());
1582         ParamObj voItem = vol.get(0);
1583         assertEquals("fileLanguages", voItem.getName());
1584         assertEquals("_.uniqBy", voItem.getStrValue(0));
1585         assertEquals("([...this.fileLanguages,...Components],p=>p.fileId)", voItem.getStrValue(1));
1586     }
1587 
1588     @Test
parseCStreamConst10()1589     void parseCStreamConst10() {
1590         ParseBase parser = ParseFactory.getParser("ts2cpp");
1591         String testType = testVariable10;
1592         CodePointCharStream cStream = CharStreams.fromString(testType);
1593         ParseObj po = parser.parseCStream(cStream);
1594         List<ParamObj> vol = po.getVarList();
1595         assertEquals(1, vol.size());
1596         ParamObj voItem = vol.get(0);
1597         assertEquals("languageMap", voItem.getName());
1598 
1599     }
1600 
1601     @Test
parseCStreamConst11()1602     void parseCStreamConst11() {
1603         ParseBase parser = ParseFactory.getParser("ts2cpp");
1604         String testType = testVariable11;
1605         CodePointCharStream cStream = CharStreams.fromString(testType);
1606         ParseObj po = parser.parseCStream(cStream);
1607         List<ParamObj> vol = po.getVarList();
1608         assertEquals(1, vol.size());
1609         ParamObj voItem = vol.get(0);
1610         assertEquals("schema", voItem.getName());
1611 
1612     }
1613 
1614     @Test
parseCStreamConst12()1615     void parseCStreamConst12() {
1616         ParseBase parser = ParseFactory.getParser("ts2cpp");
1617         String testType = testVariable12;
1618         CodePointCharStream cStream = CharStreams.fromString(testType);
1619         ParseObj po = parser.parseCStream(cStream);
1620         List<ParamObj> vol = po.getVarList();
1621         assertEquals(1, vol.size());
1622         ParamObj voItem = vol.get(0);
1623         assertEquals("codesByType", voItem.getName());
1624 
1625     }
1626 
1627     @Test
parseCStreamConst13()1628     void parseCStreamConst13() {
1629         ParseBase parser = ParseFactory.getParser("ts2cpp");
1630         String testType = testVariable13;
1631         CodePointCharStream cStream = CharStreams.fromString(testType);
1632         ParseObj po = parser.parseCStream(cStream);
1633         List<FuncObj> fol = po.getFuncList();
1634         assertEquals(1, fol.size());
1635         FuncObj foItem = fol.get(0);
1636         assertEquals("post", foItem.getAlias());
1637         assertEquals("void", foItem.getRetValue());
1638         List<ParamObj> paList = foItem.getParamList();
1639 
1640         assertEquals("any[]", paList.get(0).getType());
1641         assertEquals("...args", paList.get(0).getName());
1642     }
1643 
1644     @Test
parseCStreamConst14()1645     void parseCStreamConst14() {
1646         ParseBase parser = ParseFactory.getParser("ts2cpp");
1647         String testType = testVariable14;
1648         CodePointCharStream cStream = CharStreams.fromString(testType);
1649         ParseObj po = parser.parseCStream(cStream);
1650         List<ParamObj> vol = po.getVarList();
1651         assertEquals(1, vol.size());
1652         ParamObj voItem = vol.get(0);
1653         assertEquals("function", voItem.getName());
1654         assertEquals("([x]:any)=>x", voItem.getStrValue(0));
1655     }
1656 }