OLD | NEW |
1 library googleapis_beta.speech.v1beta1.test; | 1 library googleapis_beta.speech.v1beta1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 checkAsyncRecognizeRequest(api.AsyncRecognizeRequest o) { | 66 checkAsyncRecognizeRequest(api.AsyncRecognizeRequest o) { |
67 buildCounterAsyncRecognizeRequest++; | 67 buildCounterAsyncRecognizeRequest++; |
68 if (buildCounterAsyncRecognizeRequest < 3) { | 68 if (buildCounterAsyncRecognizeRequest < 3) { |
69 checkRecognitionAudio(o.audio); | 69 checkRecognitionAudio(o.audio); |
70 checkRecognitionConfig(o.config); | 70 checkRecognitionConfig(o.config); |
71 } | 71 } |
72 buildCounterAsyncRecognizeRequest--; | 72 buildCounterAsyncRecognizeRequest--; |
73 } | 73 } |
74 | 74 |
75 core.int buildCounterCancelOperationRequest = 0; | |
76 buildCancelOperationRequest() { | |
77 var o = new api.CancelOperationRequest(); | |
78 buildCounterCancelOperationRequest++; | |
79 if (buildCounterCancelOperationRequest < 3) { | |
80 } | |
81 buildCounterCancelOperationRequest--; | |
82 return o; | |
83 } | |
84 | |
85 checkCancelOperationRequest(api.CancelOperationRequest o) { | |
86 buildCounterCancelOperationRequest++; | |
87 if (buildCounterCancelOperationRequest < 3) { | |
88 } | |
89 buildCounterCancelOperationRequest--; | |
90 } | |
91 | |
92 core.int buildCounterEmpty = 0; | 75 core.int buildCounterEmpty = 0; |
93 buildEmpty() { | 76 buildEmpty() { |
94 var o = new api.Empty(); | 77 var o = new api.Empty(); |
95 buildCounterEmpty++; | 78 buildCounterEmpty++; |
96 if (buildCounterEmpty < 3) { | 79 if (buildCounterEmpty < 3) { |
97 } | 80 } |
98 buildCounterEmpty--; | 81 buildCounterEmpty--; |
99 return o; | 82 return o; |
100 } | 83 } |
101 | 84 |
102 checkEmpty(api.Empty o) { | 85 checkEmpty(api.Empty o) { |
103 buildCounterEmpty++; | 86 buildCounterEmpty++; |
104 if (buildCounterEmpty < 3) { | 87 if (buildCounterEmpty < 3) { |
105 } | 88 } |
106 buildCounterEmpty--; | 89 buildCounterEmpty--; |
107 } | 90 } |
108 | 91 |
109 buildUnnamed3630() { | 92 buildUnnamed3722() { |
110 var o = new core.List<api.Operation>(); | 93 var o = new core.List<api.Operation>(); |
111 o.add(buildOperation()); | 94 o.add(buildOperation()); |
112 o.add(buildOperation()); | 95 o.add(buildOperation()); |
113 return o; | 96 return o; |
114 } | 97 } |
115 | 98 |
116 checkUnnamed3630(core.List<api.Operation> o) { | 99 checkUnnamed3722(core.List<api.Operation> o) { |
117 unittest.expect(o, unittest.hasLength(2)); | 100 unittest.expect(o, unittest.hasLength(2)); |
118 checkOperation(o[0]); | 101 checkOperation(o[0]); |
119 checkOperation(o[1]); | 102 checkOperation(o[1]); |
120 } | 103 } |
121 | 104 |
122 core.int buildCounterListOperationsResponse = 0; | 105 core.int buildCounterListOperationsResponse = 0; |
123 buildListOperationsResponse() { | 106 buildListOperationsResponse() { |
124 var o = new api.ListOperationsResponse(); | 107 var o = new api.ListOperationsResponse(); |
125 buildCounterListOperationsResponse++; | 108 buildCounterListOperationsResponse++; |
126 if (buildCounterListOperationsResponse < 3) { | 109 if (buildCounterListOperationsResponse < 3) { |
127 o.nextPageToken = "foo"; | 110 o.nextPageToken = "foo"; |
128 o.operations = buildUnnamed3630(); | 111 o.operations = buildUnnamed3722(); |
129 } | 112 } |
130 buildCounterListOperationsResponse--; | 113 buildCounterListOperationsResponse--; |
131 return o; | 114 return o; |
132 } | 115 } |
133 | 116 |
134 checkListOperationsResponse(api.ListOperationsResponse o) { | 117 checkListOperationsResponse(api.ListOperationsResponse o) { |
135 buildCounterListOperationsResponse++; | 118 buildCounterListOperationsResponse++; |
136 if (buildCounterListOperationsResponse < 3) { | 119 if (buildCounterListOperationsResponse < 3) { |
137 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 120 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
138 checkUnnamed3630(o.operations); | 121 checkUnnamed3722(o.operations); |
139 } | 122 } |
140 buildCounterListOperationsResponse--; | 123 buildCounterListOperationsResponse--; |
141 } | 124 } |
142 | 125 |
143 buildUnnamed3631() { | 126 buildUnnamed3723() { |
144 var o = new core.Map<core.String, core.Object>(); | 127 var o = new core.Map<core.String, core.Object>(); |
145 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 128 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
146 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 129 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
147 return o; | 130 return o; |
148 } | 131 } |
149 | 132 |
150 checkUnnamed3631(core.Map<core.String, core.Object> o) { | 133 checkUnnamed3723(core.Map<core.String, core.Object> o) { |
151 unittest.expect(o, unittest.hasLength(2)); | 134 unittest.expect(o, unittest.hasLength(2)); |
152 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 135 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); |
153 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 136 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); |
154 } | 137 } |
155 | 138 |
156 buildUnnamed3632() { | 139 buildUnnamed3724() { |
157 var o = new core.Map<core.String, core.Object>(); | 140 var o = new core.Map<core.String, core.Object>(); |
158 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 141 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
159 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 142 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
160 return o; | 143 return o; |
161 } | 144 } |
162 | 145 |
163 checkUnnamed3632(core.Map<core.String, core.Object> o) { | 146 checkUnnamed3724(core.Map<core.String, core.Object> o) { |
164 unittest.expect(o, unittest.hasLength(2)); | 147 unittest.expect(o, unittest.hasLength(2)); |
165 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); | 148 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); |
166 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | 149 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
167 } | 150 } |
168 | 151 |
169 core.int buildCounterOperation = 0; | 152 core.int buildCounterOperation = 0; |
170 buildOperation() { | 153 buildOperation() { |
171 var o = new api.Operation(); | 154 var o = new api.Operation(); |
172 buildCounterOperation++; | 155 buildCounterOperation++; |
173 if (buildCounterOperation < 3) { | 156 if (buildCounterOperation < 3) { |
174 o.done = true; | 157 o.done = true; |
175 o.error = buildStatus(); | 158 o.error = buildStatus(); |
176 o.metadata = buildUnnamed3631(); | 159 o.metadata = buildUnnamed3723(); |
177 o.name = "foo"; | 160 o.name = "foo"; |
178 o.response = buildUnnamed3632(); | 161 o.response = buildUnnamed3724(); |
179 } | 162 } |
180 buildCounterOperation--; | 163 buildCounterOperation--; |
181 return o; | 164 return o; |
182 } | 165 } |
183 | 166 |
184 checkOperation(api.Operation o) { | 167 checkOperation(api.Operation o) { |
185 buildCounterOperation++; | 168 buildCounterOperation++; |
186 if (buildCounterOperation < 3) { | 169 if (buildCounterOperation < 3) { |
187 unittest.expect(o.done, unittest.isTrue); | 170 unittest.expect(o.done, unittest.isTrue); |
188 checkStatus(o.error); | 171 checkStatus(o.error); |
189 checkUnnamed3631(o.metadata); | 172 checkUnnamed3723(o.metadata); |
190 unittest.expect(o.name, unittest.equals('foo')); | 173 unittest.expect(o.name, unittest.equals('foo')); |
191 checkUnnamed3632(o.response); | 174 checkUnnamed3724(o.response); |
192 } | 175 } |
193 buildCounterOperation--; | 176 buildCounterOperation--; |
194 } | 177 } |
195 | 178 |
196 core.int buildCounterRecognitionAudio = 0; | 179 core.int buildCounterRecognitionAudio = 0; |
197 buildRecognitionAudio() { | 180 buildRecognitionAudio() { |
198 var o = new api.RecognitionAudio(); | 181 var o = new api.RecognitionAudio(); |
199 buildCounterRecognitionAudio++; | 182 buildCounterRecognitionAudio++; |
200 if (buildCounterRecognitionAudio < 3) { | 183 if (buildCounterRecognitionAudio < 3) { |
201 o.content = "foo"; | 184 o.content = "foo"; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 unittest.expect(o.encoding, unittest.equals('foo')); | 219 unittest.expect(o.encoding, unittest.equals('foo')); |
237 unittest.expect(o.languageCode, unittest.equals('foo')); | 220 unittest.expect(o.languageCode, unittest.equals('foo')); |
238 unittest.expect(o.maxAlternatives, unittest.equals(42)); | 221 unittest.expect(o.maxAlternatives, unittest.equals(42)); |
239 unittest.expect(o.profanityFilter, unittest.isTrue); | 222 unittest.expect(o.profanityFilter, unittest.isTrue); |
240 unittest.expect(o.sampleRate, unittest.equals(42)); | 223 unittest.expect(o.sampleRate, unittest.equals(42)); |
241 checkSpeechContext(o.speechContext); | 224 checkSpeechContext(o.speechContext); |
242 } | 225 } |
243 buildCounterRecognitionConfig--; | 226 buildCounterRecognitionConfig--; |
244 } | 227 } |
245 | 228 |
246 buildUnnamed3633() { | 229 buildUnnamed3725() { |
247 var o = new core.List<core.String>(); | 230 var o = new core.List<core.String>(); |
248 o.add("foo"); | 231 o.add("foo"); |
249 o.add("foo"); | 232 o.add("foo"); |
250 return o; | 233 return o; |
251 } | 234 } |
252 | 235 |
253 checkUnnamed3633(core.List<core.String> o) { | 236 checkUnnamed3725(core.List<core.String> o) { |
254 unittest.expect(o, unittest.hasLength(2)); | 237 unittest.expect(o, unittest.hasLength(2)); |
255 unittest.expect(o[0], unittest.equals('foo')); | 238 unittest.expect(o[0], unittest.equals('foo')); |
256 unittest.expect(o[1], unittest.equals('foo')); | 239 unittest.expect(o[1], unittest.equals('foo')); |
257 } | 240 } |
258 | 241 |
259 core.int buildCounterSpeechContext = 0; | 242 core.int buildCounterSpeechContext = 0; |
260 buildSpeechContext() { | 243 buildSpeechContext() { |
261 var o = new api.SpeechContext(); | 244 var o = new api.SpeechContext(); |
262 buildCounterSpeechContext++; | 245 buildCounterSpeechContext++; |
263 if (buildCounterSpeechContext < 3) { | 246 if (buildCounterSpeechContext < 3) { |
264 o.phrases = buildUnnamed3633(); | 247 o.phrases = buildUnnamed3725(); |
265 } | 248 } |
266 buildCounterSpeechContext--; | 249 buildCounterSpeechContext--; |
267 return o; | 250 return o; |
268 } | 251 } |
269 | 252 |
270 checkSpeechContext(api.SpeechContext o) { | 253 checkSpeechContext(api.SpeechContext o) { |
271 buildCounterSpeechContext++; | 254 buildCounterSpeechContext++; |
272 if (buildCounterSpeechContext < 3) { | 255 if (buildCounterSpeechContext < 3) { |
273 checkUnnamed3633(o.phrases); | 256 checkUnnamed3725(o.phrases); |
274 } | 257 } |
275 buildCounterSpeechContext--; | 258 buildCounterSpeechContext--; |
276 } | 259 } |
277 | 260 |
278 core.int buildCounterSpeechRecognitionAlternative = 0; | 261 core.int buildCounterSpeechRecognitionAlternative = 0; |
279 buildSpeechRecognitionAlternative() { | 262 buildSpeechRecognitionAlternative() { |
280 var o = new api.SpeechRecognitionAlternative(); | 263 var o = new api.SpeechRecognitionAlternative(); |
281 buildCounterSpeechRecognitionAlternative++; | 264 buildCounterSpeechRecognitionAlternative++; |
282 if (buildCounterSpeechRecognitionAlternative < 3) { | 265 if (buildCounterSpeechRecognitionAlternative < 3) { |
283 o.confidence = 42.0; | 266 o.confidence = 42.0; |
284 o.transcript = "foo"; | 267 o.transcript = "foo"; |
285 } | 268 } |
286 buildCounterSpeechRecognitionAlternative--; | 269 buildCounterSpeechRecognitionAlternative--; |
287 return o; | 270 return o; |
288 } | 271 } |
289 | 272 |
290 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) { | 273 checkSpeechRecognitionAlternative(api.SpeechRecognitionAlternative o) { |
291 buildCounterSpeechRecognitionAlternative++; | 274 buildCounterSpeechRecognitionAlternative++; |
292 if (buildCounterSpeechRecognitionAlternative < 3) { | 275 if (buildCounterSpeechRecognitionAlternative < 3) { |
293 unittest.expect(o.confidence, unittest.equals(42.0)); | 276 unittest.expect(o.confidence, unittest.equals(42.0)); |
294 unittest.expect(o.transcript, unittest.equals('foo')); | 277 unittest.expect(o.transcript, unittest.equals('foo')); |
295 } | 278 } |
296 buildCounterSpeechRecognitionAlternative--; | 279 buildCounterSpeechRecognitionAlternative--; |
297 } | 280 } |
298 | 281 |
299 buildUnnamed3634() { | 282 buildUnnamed3726() { |
300 var o = new core.List<api.SpeechRecognitionAlternative>(); | 283 var o = new core.List<api.SpeechRecognitionAlternative>(); |
301 o.add(buildSpeechRecognitionAlternative()); | 284 o.add(buildSpeechRecognitionAlternative()); |
302 o.add(buildSpeechRecognitionAlternative()); | 285 o.add(buildSpeechRecognitionAlternative()); |
303 return o; | 286 return o; |
304 } | 287 } |
305 | 288 |
306 checkUnnamed3634(core.List<api.SpeechRecognitionAlternative> o) { | 289 checkUnnamed3726(core.List<api.SpeechRecognitionAlternative> o) { |
307 unittest.expect(o, unittest.hasLength(2)); | 290 unittest.expect(o, unittest.hasLength(2)); |
308 checkSpeechRecognitionAlternative(o[0]); | 291 checkSpeechRecognitionAlternative(o[0]); |
309 checkSpeechRecognitionAlternative(o[1]); | 292 checkSpeechRecognitionAlternative(o[1]); |
310 } | 293 } |
311 | 294 |
312 core.int buildCounterSpeechRecognitionResult = 0; | 295 core.int buildCounterSpeechRecognitionResult = 0; |
313 buildSpeechRecognitionResult() { | 296 buildSpeechRecognitionResult() { |
314 var o = new api.SpeechRecognitionResult(); | 297 var o = new api.SpeechRecognitionResult(); |
315 buildCounterSpeechRecognitionResult++; | 298 buildCounterSpeechRecognitionResult++; |
316 if (buildCounterSpeechRecognitionResult < 3) { | 299 if (buildCounterSpeechRecognitionResult < 3) { |
317 o.alternatives = buildUnnamed3634(); | 300 o.alternatives = buildUnnamed3726(); |
318 } | 301 } |
319 buildCounterSpeechRecognitionResult--; | 302 buildCounterSpeechRecognitionResult--; |
320 return o; | 303 return o; |
321 } | 304 } |
322 | 305 |
323 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) { | 306 checkSpeechRecognitionResult(api.SpeechRecognitionResult o) { |
324 buildCounterSpeechRecognitionResult++; | 307 buildCounterSpeechRecognitionResult++; |
325 if (buildCounterSpeechRecognitionResult < 3) { | 308 if (buildCounterSpeechRecognitionResult < 3) { |
326 checkUnnamed3634(o.alternatives); | 309 checkUnnamed3726(o.alternatives); |
327 } | 310 } |
328 buildCounterSpeechRecognitionResult--; | 311 buildCounterSpeechRecognitionResult--; |
329 } | 312 } |
330 | 313 |
331 buildUnnamed3635() { | 314 buildUnnamed3727() { |
332 var o = new core.Map<core.String, core.Object>(); | 315 var o = new core.Map<core.String, core.Object>(); |
333 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 316 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
334 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 317 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
335 return o; | 318 return o; |
336 } | 319 } |
337 | 320 |
338 checkUnnamed3635(core.Map<core.String, core.Object> o) { | 321 checkUnnamed3727(core.Map<core.String, core.Object> o) { |
339 unittest.expect(o, unittest.hasLength(2)); | 322 unittest.expect(o, unittest.hasLength(2)); |
340 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | 323 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
341 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | 324 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
342 } | 325 } |
343 | 326 |
344 buildUnnamed3636() { | 327 buildUnnamed3728() { |
345 var o = new core.List<core.Map<core.String, core.Object>>(); | 328 var o = new core.List<core.Map<core.String, core.Object>>(); |
346 o.add(buildUnnamed3635()); | 329 o.add(buildUnnamed3727()); |
347 o.add(buildUnnamed3635()); | 330 o.add(buildUnnamed3727()); |
348 return o; | 331 return o; |
349 } | 332 } |
350 | 333 |
351 checkUnnamed3636(core.List<core.Map<core.String, core.Object>> o) { | 334 checkUnnamed3728(core.List<core.Map<core.String, core.Object>> o) { |
352 unittest.expect(o, unittest.hasLength(2)); | 335 unittest.expect(o, unittest.hasLength(2)); |
353 checkUnnamed3635(o[0]); | 336 checkUnnamed3727(o[0]); |
354 checkUnnamed3635(o[1]); | 337 checkUnnamed3727(o[1]); |
355 } | 338 } |
356 | 339 |
357 core.int buildCounterStatus = 0; | 340 core.int buildCounterStatus = 0; |
358 buildStatus() { | 341 buildStatus() { |
359 var o = new api.Status(); | 342 var o = new api.Status(); |
360 buildCounterStatus++; | 343 buildCounterStatus++; |
361 if (buildCounterStatus < 3) { | 344 if (buildCounterStatus < 3) { |
362 o.code = 42; | 345 o.code = 42; |
363 o.details = buildUnnamed3636(); | 346 o.details = buildUnnamed3728(); |
364 o.message = "foo"; | 347 o.message = "foo"; |
365 } | 348 } |
366 buildCounterStatus--; | 349 buildCounterStatus--; |
367 return o; | 350 return o; |
368 } | 351 } |
369 | 352 |
370 checkStatus(api.Status o) { | 353 checkStatus(api.Status o) { |
371 buildCounterStatus++; | 354 buildCounterStatus++; |
372 if (buildCounterStatus < 3) { | 355 if (buildCounterStatus < 3) { |
373 unittest.expect(o.code, unittest.equals(42)); | 356 unittest.expect(o.code, unittest.equals(42)); |
374 checkUnnamed3636(o.details); | 357 checkUnnamed3728(o.details); |
375 unittest.expect(o.message, unittest.equals('foo')); | 358 unittest.expect(o.message, unittest.equals('foo')); |
376 } | 359 } |
377 buildCounterStatus--; | 360 buildCounterStatus--; |
378 } | 361 } |
379 | 362 |
380 core.int buildCounterSyncRecognizeRequest = 0; | 363 core.int buildCounterSyncRecognizeRequest = 0; |
381 buildSyncRecognizeRequest() { | 364 buildSyncRecognizeRequest() { |
382 var o = new api.SyncRecognizeRequest(); | 365 var o = new api.SyncRecognizeRequest(); |
383 buildCounterSyncRecognizeRequest++; | 366 buildCounterSyncRecognizeRequest++; |
384 if (buildCounterSyncRecognizeRequest < 3) { | 367 if (buildCounterSyncRecognizeRequest < 3) { |
385 o.audio = buildRecognitionAudio(); | 368 o.audio = buildRecognitionAudio(); |
386 o.config = buildRecognitionConfig(); | 369 o.config = buildRecognitionConfig(); |
387 } | 370 } |
388 buildCounterSyncRecognizeRequest--; | 371 buildCounterSyncRecognizeRequest--; |
389 return o; | 372 return o; |
390 } | 373 } |
391 | 374 |
392 checkSyncRecognizeRequest(api.SyncRecognizeRequest o) { | 375 checkSyncRecognizeRequest(api.SyncRecognizeRequest o) { |
393 buildCounterSyncRecognizeRequest++; | 376 buildCounterSyncRecognizeRequest++; |
394 if (buildCounterSyncRecognizeRequest < 3) { | 377 if (buildCounterSyncRecognizeRequest < 3) { |
395 checkRecognitionAudio(o.audio); | 378 checkRecognitionAudio(o.audio); |
396 checkRecognitionConfig(o.config); | 379 checkRecognitionConfig(o.config); |
397 } | 380 } |
398 buildCounterSyncRecognizeRequest--; | 381 buildCounterSyncRecognizeRequest--; |
399 } | 382 } |
400 | 383 |
401 buildUnnamed3637() { | 384 buildUnnamed3729() { |
402 var o = new core.List<api.SpeechRecognitionResult>(); | 385 var o = new core.List<api.SpeechRecognitionResult>(); |
403 o.add(buildSpeechRecognitionResult()); | 386 o.add(buildSpeechRecognitionResult()); |
404 o.add(buildSpeechRecognitionResult()); | 387 o.add(buildSpeechRecognitionResult()); |
405 return o; | 388 return o; |
406 } | 389 } |
407 | 390 |
408 checkUnnamed3637(core.List<api.SpeechRecognitionResult> o) { | 391 checkUnnamed3729(core.List<api.SpeechRecognitionResult> o) { |
409 unittest.expect(o, unittest.hasLength(2)); | 392 unittest.expect(o, unittest.hasLength(2)); |
410 checkSpeechRecognitionResult(o[0]); | 393 checkSpeechRecognitionResult(o[0]); |
411 checkSpeechRecognitionResult(o[1]); | 394 checkSpeechRecognitionResult(o[1]); |
412 } | 395 } |
413 | 396 |
414 core.int buildCounterSyncRecognizeResponse = 0; | 397 core.int buildCounterSyncRecognizeResponse = 0; |
415 buildSyncRecognizeResponse() { | 398 buildSyncRecognizeResponse() { |
416 var o = new api.SyncRecognizeResponse(); | 399 var o = new api.SyncRecognizeResponse(); |
417 buildCounterSyncRecognizeResponse++; | 400 buildCounterSyncRecognizeResponse++; |
418 if (buildCounterSyncRecognizeResponse < 3) { | 401 if (buildCounterSyncRecognizeResponse < 3) { |
419 o.results = buildUnnamed3637(); | 402 o.results = buildUnnamed3729(); |
420 } | 403 } |
421 buildCounterSyncRecognizeResponse--; | 404 buildCounterSyncRecognizeResponse--; |
422 return o; | 405 return o; |
423 } | 406 } |
424 | 407 |
425 checkSyncRecognizeResponse(api.SyncRecognizeResponse o) { | 408 checkSyncRecognizeResponse(api.SyncRecognizeResponse o) { |
426 buildCounterSyncRecognizeResponse++; | 409 buildCounterSyncRecognizeResponse++; |
427 if (buildCounterSyncRecognizeResponse < 3) { | 410 if (buildCounterSyncRecognizeResponse < 3) { |
428 checkUnnamed3637(o.results); | 411 checkUnnamed3729(o.results); |
429 } | 412 } |
430 buildCounterSyncRecognizeResponse--; | 413 buildCounterSyncRecognizeResponse--; |
431 } | 414 } |
432 | 415 |
433 | 416 |
434 main() { | 417 main() { |
435 unittest.group("obj-schema-AsyncRecognizeRequest", () { | 418 unittest.group("obj-schema-AsyncRecognizeRequest", () { |
436 unittest.test("to-json--from-json", () { | 419 unittest.test("to-json--from-json", () { |
437 var o = buildAsyncRecognizeRequest(); | 420 var o = buildAsyncRecognizeRequest(); |
438 var od = new api.AsyncRecognizeRequest.fromJson(o.toJson()); | 421 var od = new api.AsyncRecognizeRequest.fromJson(o.toJson()); |
439 checkAsyncRecognizeRequest(od); | 422 checkAsyncRecognizeRequest(od); |
440 }); | 423 }); |
441 }); | 424 }); |
442 | 425 |
443 | 426 |
444 unittest.group("obj-schema-CancelOperationRequest", () { | |
445 unittest.test("to-json--from-json", () { | |
446 var o = buildCancelOperationRequest(); | |
447 var od = new api.CancelOperationRequest.fromJson(o.toJson()); | |
448 checkCancelOperationRequest(od); | |
449 }); | |
450 }); | |
451 | |
452 | |
453 unittest.group("obj-schema-Empty", () { | 427 unittest.group("obj-schema-Empty", () { |
454 unittest.test("to-json--from-json", () { | 428 unittest.test("to-json--from-json", () { |
455 var o = buildEmpty(); | 429 var o = buildEmpty(); |
456 var od = new api.Empty.fromJson(o.toJson()); | 430 var od = new api.Empty.fromJson(o.toJson()); |
457 checkEmpty(od); | 431 checkEmpty(od); |
458 }); | 432 }); |
459 }); | 433 }); |
460 | 434 |
461 | 435 |
462 unittest.group("obj-schema-ListOperationsResponse", () { | 436 unittest.group("obj-schema-ListOperationsResponse", () { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 checkSyncRecognizeResponse(od); | 521 checkSyncRecognizeResponse(od); |
548 }); | 522 }); |
549 }); | 523 }); |
550 | 524 |
551 | 525 |
552 unittest.group("resource-OperationsResourceApi", () { | 526 unittest.group("resource-OperationsResourceApi", () { |
553 unittest.test("method--cancel", () { | 527 unittest.test("method--cancel", () { |
554 | 528 |
555 var mock = new HttpServerMock(); | 529 var mock = new HttpServerMock(); |
556 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 530 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
557 var arg_request = buildCancelOperationRequest(); | |
558 var arg_name = "foo"; | 531 var arg_name = "foo"; |
559 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 532 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
560 var obj = new api.CancelOperationRequest.fromJson(json); | |
561 checkCancelOperationRequest(obj); | |
562 | |
563 var path = (req.url).path; | 533 var path = (req.url).path; |
564 var pathOffset = 0; | 534 var pathOffset = 0; |
565 var index; | 535 var index; |
566 var subPart; | 536 var subPart; |
567 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 537 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
568 pathOffset += 1; | 538 pathOffset += 1; |
569 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("v1beta1/operations/")); | 539 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("v1beta1/operations/")); |
570 pathOffset += 19; | 540 pathOffset += 19; |
571 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 541 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
572 | 542 |
(...skipping 14 matching lines...) Expand all Loading... |
587 } | 557 } |
588 } | 558 } |
589 | 559 |
590 | 560 |
591 var h = { | 561 var h = { |
592 "content-type" : "application/json; charset=utf-8", | 562 "content-type" : "application/json; charset=utf-8", |
593 }; | 563 }; |
594 var resp = convert.JSON.encode(buildEmpty()); | 564 var resp = convert.JSON.encode(buildEmpty()); |
595 return new async.Future.value(stringResponse(200, h, resp)); | 565 return new async.Future.value(stringResponse(200, h, resp)); |
596 }), true); | 566 }), true); |
597 res.cancel(arg_request, arg_name).then(unittest.expectAsync(((api.Empty re
sponse) { | 567 res.cancel(arg_name).then(unittest.expectAsync(((api.Empty response) { |
598 checkEmpty(response); | 568 checkEmpty(response); |
599 }))); | 569 }))); |
600 }); | 570 }); |
601 | 571 |
602 unittest.test("method--delete", () { | 572 unittest.test("method--delete", () { |
603 | 573 |
604 var mock = new HttpServerMock(); | 574 var mock = new HttpServerMock(); |
605 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 575 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
606 var arg_name = "foo"; | 576 var arg_name = "foo"; |
607 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 577 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 }), true); | 656 }), true); |
687 res.get(arg_name).then(unittest.expectAsync(((api.Operation response) { | 657 res.get(arg_name).then(unittest.expectAsync(((api.Operation response) { |
688 checkOperation(response); | 658 checkOperation(response); |
689 }))); | 659 }))); |
690 }); | 660 }); |
691 | 661 |
692 unittest.test("method--list", () { | 662 unittest.test("method--list", () { |
693 | 663 |
694 var mock = new HttpServerMock(); | 664 var mock = new HttpServerMock(); |
695 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; | 665 api.OperationsResourceApi res = new api.SpeechApi(mock).operations; |
| 666 var arg_name = "foo"; |
| 667 var arg_pageToken = "foo"; |
696 var arg_pageSize = 42; | 668 var arg_pageSize = 42; |
697 var arg_filter = "foo"; | 669 var arg_filter = "foo"; |
698 var arg_name = "foo"; | |
699 var arg_pageToken = "foo"; | |
700 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 670 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
701 var path = (req.url).path; | 671 var path = (req.url).path; |
702 var pathOffset = 0; | 672 var pathOffset = 0; |
703 var index; | 673 var index; |
704 var subPart; | 674 var subPart; |
705 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 675 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
706 pathOffset += 1; | 676 pathOffset += 1; |
707 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v1beta1/operations")); | 677 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v1beta1/operations")); |
708 pathOffset += 18; | 678 pathOffset += 18; |
709 | 679 |
710 var query = (req.url).query; | 680 var query = (req.url).query; |
711 var queryOffset = 0; | 681 var queryOffset = 0; |
712 var queryMap = {}; | 682 var queryMap = {}; |
713 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 683 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
714 parseBool(n) { | 684 parseBool(n) { |
715 if (n == "true") return true; | 685 if (n == "true") return true; |
716 if (n == "false") return false; | 686 if (n == "false") return false; |
717 if (n == null) return null; | 687 if (n == null) return null; |
718 throw new core.ArgumentError("Invalid boolean: $n"); | 688 throw new core.ArgumentError("Invalid boolean: $n"); |
719 } | 689 } |
720 if (query.length > 0) { | 690 if (query.length > 0) { |
721 for (var part in query.split("&")) { | 691 for (var part in query.split("&")) { |
722 var keyvalue = part.split("="); | 692 var keyvalue = part.split("="); |
723 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 693 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
724 } | 694 } |
725 } | 695 } |
| 696 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
| 697 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
726 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 698 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
727 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 699 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
728 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); | |
729 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
730 | 700 |
731 | 701 |
732 var h = { | 702 var h = { |
733 "content-type" : "application/json; charset=utf-8", | 703 "content-type" : "application/json; charset=utf-8", |
734 }; | 704 }; |
735 var resp = convert.JSON.encode(buildListOperationsResponse()); | 705 var resp = convert.JSON.encode(buildListOperationsResponse()); |
736 return new async.Future.value(stringResponse(200, h, resp)); | 706 return new async.Future.value(stringResponse(200, h, resp)); |
737 }), true); | 707 }), true); |
738 res.list(pageSize: arg_pageSize, filter: arg_filter, name: arg_name, pageT
oken: arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse resp
onse) { | 708 res.list(name: arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize,
filter: arg_filter).then(unittest.expectAsync(((api.ListOperationsResponse resp
onse) { |
739 checkListOperationsResponse(response); | 709 checkListOperationsResponse(response); |
740 }))); | 710 }))); |
741 }); | 711 }); |
742 | 712 |
743 }); | 713 }); |
744 | 714 |
745 | 715 |
746 unittest.group("resource-SpeechResourceApi", () { | 716 unittest.group("resource-SpeechResourceApi", () { |
747 unittest.test("method--asyncrecognize", () { | 717 unittest.test("method--asyncrecognize", () { |
748 | 718 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 res.syncrecognize(arg_request).then(unittest.expectAsync(((api.SyncRecogni
zeResponse response) { | 806 res.syncrecognize(arg_request).then(unittest.expectAsync(((api.SyncRecogni
zeResponse response) { |
837 checkSyncRecognizeResponse(response); | 807 checkSyncRecognizeResponse(response); |
838 }))); | 808 }))); |
839 }); | 809 }); |
840 | 810 |
841 }); | 811 }); |
842 | 812 |
843 | 813 |
844 } | 814 } |
845 | 815 |
OLD | NEW |