blob: 98f54af5ca57337e4a6f59c1136fc323fa429bb6 [file] [log] [blame]
Cameron Martincaef0ed2025-01-15 11:58:39 +01001"use strict";
wilfrem2c69b5a2015-04-20 19:24:50 +09002
Cameron Martincaef0ed2025-01-15 11:58:39 +01003import ttypes = require("./gen-nodejs/ThriftTest_types");
4import Int64 = require("node-int64");
wilfrem2c69b5a2015-04-20 19:24:50 +09005
6//all Languages in UTF-8
7/*jshint -W100 */
Cameron Martincaef0ed2025-01-15 11:58:39 +01008export var stringTest =
9 "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, " +
10 "Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, " +
11 "Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, " +
12 "বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, " +
13 "Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, " +
14 "Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, " +
15 "Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, " +
16 "Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, " +
17 "Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, " +
18 "Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, " +
19 "Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, " +
20 "ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, " +
21 "Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, " +
22 "Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa " +
23 "Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa " +
24 "Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, ‪" +
25 "Norsk (nynorsk)‬, ‪Norsk (bokmål)‬, Nouormand, Diné bizaad, " +
26 "Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, " +
27 "Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, " +
28 "Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple " +
29 "English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, " +
30 "Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, " +
31 "Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, " +
32 "Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, " +
33 "Bân-lâm-gú, 粵語";
wilfrem2c69b5a2015-04-20 19:24:50 +090034/*jshint +W100 */
35
Cameron Martincaef0ed2025-01-15 11:58:39 +010036export var specialCharacters =
37 'quote: \" backslash:' +
38 " forwardslash-escaped: \/ " +
39 " backspace: \b formfeed: \f newline: \n return: \r tab: " +
40 ' now-all-of-them-together: "\\\/\b\n\r\t' +
41 " now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><" +
42 ' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';
wilfrem2c69b5a2015-04-20 19:24:50 +090043
44export var mapTestInput = {
Cameron Martincaef0ed2025-01-15 11:58:39 +010045 a: "123",
46 "a b": "with spaces ",
47 same: "same",
48 "0": "numeric key",
49 longValue: stringTest,
50 stringTest: "long key",
wilfrem2c69b5a2015-04-20 19:24:50 +090051};
52
53export var simple = [
Cameron Martincaef0ed2025-01-15 11:58:39 +010054 ["testVoid", undefined],
55 ["testString", "Test"],
56 ["testString", ""],
57 ["testString", stringTest],
58 ["testString", specialCharacters],
59 ["testByte", 1],
60 ["testByte", 0],
61 ["testByte", -1],
62 ["testByte", -127],
63 ["testI32", -1],
64 ["testDouble", -5.2098523],
65 ["testDouble", 7.012052175215044],
66 ["testEnum", ttypes.Numberz.ONE],
wilfrem2c69b5a2015-04-20 19:24:50 +090067];
68
69export var simpleLoose = [
Cameron Martincaef0ed2025-01-15 11:58:39 +010070 ["testI64", 5],
71 ["testI64", -5],
72 ["testI64", 734359738368],
73 ["testI64", -34359738368],
74 ["testI64", -734359738368],
75 ["testTypedef", 69],
76];
wilfrem2c69b5a2015-04-20 19:24:50 +090077
Cameron Martincaef0ed2025-01-15 11:58:39 +010078var mapout: { [key: number]: number } = {};
wilfrem2c69b5a2015-04-20 19:24:50 +090079for (var i = 0; i < 5; ++i) {
Cameron Martincaef0ed2025-01-15 11:58:39 +010080 mapout[i] = i - 10;
wilfrem2c69b5a2015-04-20 19:24:50 +090081}
82
83export var deep = [
Cameron Martincaef0ed2025-01-15 11:58:39 +010084 ["testMap", mapout],
85 ["testSet", [1, 2, 3]],
86 [
87 "testList",
88 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
89 ],
90 ["testStringMap", mapTestInput],
wilfrem2c69b5a2015-04-20 19:24:50 +090091];
92
93export var out = new ttypes.Xtruct({
Cameron Martincaef0ed2025-01-15 11:58:39 +010094 string_thing: "Zero",
wilfrem2c69b5a2015-04-20 19:24:50 +090095 byte_thing: 1,
96 i32_thing: -3,
Cameron Martincaef0ed2025-01-15 11:58:39 +010097 i64_thing: new Int64(1000000),
wilfrem2c69b5a2015-04-20 19:24:50 +090098});
99
100export var out2 = new ttypes.Xtruct2();
101out2.byte_thing = 1;
102out2.struct_thing = out;
103out2.i32_thing = 5;
104
105export var crazy = new ttypes.Insanity({
Cameron Martincaef0ed2025-01-15 11:58:39 +0100106 userMap: { "5": new Int64(5), "8": new Int64(8) },
107 xtructs: [
108 new ttypes.Xtruct({
109 string_thing: "Goodbye4",
110 byte_thing: 4,
111 i32_thing: 4,
112 i64_thing: new Int64(4),
113 }),
114 new ttypes.Xtruct({
115 string_thing: "Hello2",
116 byte_thing: 2,
117 i32_thing: 2,
118 i64_thing: new Int64(2),
119 }),
120 ],
wilfrem2c69b5a2015-04-20 19:24:50 +0900121});
122
123export var insanity: any = {
Cameron Martincaef0ed2025-01-15 11:58:39 +0100124 "1": { "2": crazy, "3": crazy },
125 "2": { "6": { userMap: {}, xtructs: [] } },
wilfrem2c69b5a2015-04-20 19:24:50 +0900126};