262 267 | .expect("the config must have a deserializer");
|
263 268 |
|
264 269 | let parsed = de.deserialize_streaming(&mut http_response);
|
265 270 | let parsed = parsed.unwrap_or_else(|| {
|
266 271 | let http_response = http_response.map(|body| {
|
267 272 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
268 273 | body.bytes().unwrap(),
|
269 274 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
270 275 | )))
|
271 276 | });
|
272 - | de.deserialize_nonstreaming(&http_response)
|
277 + | // Build a config bag with the protocol for schema-based deserialization
|
278 + | #[allow(unused_mut)]
|
279 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
280 + |
|
281 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
273 282 | });
|
274 283 | let parsed = parsed
|
275 284 | .expect("should be successful response")
|
276 285 | .downcast::<crate::operation::float16::Float16Output>()
|
277 286 | .unwrap();
|
278 287 | assert!(
|
279 288 | parsed.value.float_equals(&expected_output.value),
|
280 289 | "Unexpected value for `value` {:?} vs. {:?}",
|
281 290 | expected_output.value,
|
282 291 | parsed.value
|
283 292 | );
|
284 293 | }
|
285 294 |
|
286 295 | /// Ensures that clients can correctly parse float16 -Inf.
|
287 296 | /// Test ID: RpcV2CborFloat16NegInf
|
288 297 | #[::tokio::test]
|
289 298 | #[::tracing_test::traced_test]
|
290 299 | async fn rpc_v2_cbor_float16_neg_inf_response() {
|
291 300 | let expected_output = crate::operation::float16::Float16Output::builder()
|
292 301 | .set_value(::std::option::Option::Some(
|
293 302 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|
294 303 | ))
|
295 304 | .build();
|
296 305 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
297 306 | ::http_1x::response::Builder::new()
|
298 307 | .header("Content-Type", "application/cbor")
|
299 308 | .header("smithy-protocol", "rpc-v2-cbor")
|
300 309 | .status(200)
|
301 310 | .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfn8AA=="))
|
302 311 | .unwrap(),
|
303 312 | )
|
304 313 | .unwrap();
|
305 314 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
306 315 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
307 316 |
|
308 317 | let op = crate::operation::float16::Float16::new();
|
309 318 | let config = op.config().expect("the operation has config");
|
310 319 | let de = config
|
311 320 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
312 321 | .expect("the config must have a deserializer");
|
313 322 |
|
314 323 | let parsed = de.deserialize_streaming(&mut http_response);
|
315 324 | let parsed = parsed.unwrap_or_else(|| {
|
316 325 | let http_response = http_response.map(|body| {
|
317 326 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
318 327 | body.bytes().unwrap(),
|
319 328 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
320 329 | )))
|
321 330 | });
|
322 - | de.deserialize_nonstreaming(&http_response)
|
331 + | // Build a config bag with the protocol for schema-based deserialization
|
332 + | #[allow(unused_mut)]
|
333 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
334 + |
|
335 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
323 336 | });
|
324 337 | let parsed = parsed
|
325 338 | .expect("should be successful response")
|
326 339 | .downcast::<crate::operation::float16::Float16Output>()
|
327 340 | .unwrap();
|
328 341 | assert!(
|
329 342 | parsed.value.float_equals(&expected_output.value),
|
330 343 | "Unexpected value for `value` {:?} vs. {:?}",
|
331 344 | expected_output.value,
|
332 345 | parsed.value
|
333 346 | );
|
334 347 | }
|
335 348 |
|
336 349 | /// Ensures that clients can correctly parse float16 NaN with high LSB.
|
337 350 | /// Test ID: RpcV2CborFloat16LSBNaN
|
338 351 | #[::tokio::test]
|
339 352 | #[::tracing_test::traced_test]
|
340 353 | async fn rpc_v2_cbor_float16_lsb_na_n_response() {
|
341 354 | let expected_output = crate::operation::float16::Float16Output::builder()
|
342 355 | .set_value(::std::option::Option::Some(
|
343 356 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
344 357 | ))
|
345 358 | .build();
|
346 359 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
347 360 | ::http_1x::response::Builder::new()
|
348 361 | .header("Content-Type", "application/cbor")
|
349 362 | .header("smithy-protocol", "rpc-v2-cbor")
|
350 363 | .status(200)
|
351 364 | .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfl8AQ=="))
|
352 365 | .unwrap(),
|
353 366 | )
|
354 367 | .unwrap();
|
355 368 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
356 369 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
357 370 |
|
358 371 | let op = crate::operation::float16::Float16::new();
|
359 372 | let config = op.config().expect("the operation has config");
|
360 373 | let de = config
|
361 374 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
362 375 | .expect("the config must have a deserializer");
|
363 376 |
|
364 377 | let parsed = de.deserialize_streaming(&mut http_response);
|
365 378 | let parsed = parsed.unwrap_or_else(|| {
|
366 379 | let http_response = http_response.map(|body| {
|
367 380 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
368 381 | body.bytes().unwrap(),
|
369 382 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
370 383 | )))
|
371 384 | });
|
372 - | de.deserialize_nonstreaming(&http_response)
|
385 + | // Build a config bag with the protocol for schema-based deserialization
|
386 + | #[allow(unused_mut)]
|
387 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
388 + |
|
389 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
373 390 | });
|
374 391 | let parsed = parsed
|
375 392 | .expect("should be successful response")
|
376 393 | .downcast::<crate::operation::float16::Float16Output>()
|
377 394 | .unwrap();
|
378 395 | assert!(
|
379 396 | parsed.value.float_equals(&expected_output.value),
|
380 397 | "Unexpected value for `value` {:?} vs. {:?}",
|
381 398 | expected_output.value,
|
382 399 | parsed.value
|
383 400 | );
|
384 401 | }
|
385 402 |
|
386 403 | /// Ensures that clients can correctly parse float16 NaN with high MSB.
|
387 404 | /// Test ID: RpcV2CborFloat16MSBNaN
|
388 405 | #[::tokio::test]
|
389 406 | #[::tracing_test::traced_test]
|
390 407 | async fn rpc_v2_cbor_float16_msb_na_n_response() {
|
391 408 | let expected_output = crate::operation::float16::Float16Output::builder()
|
392 409 | .set_value(::std::option::Option::Some(
|
393 410 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
394 411 | ))
|
395 412 | .build();
|
396 413 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
397 414 | ::http_1x::response::Builder::new()
|
398 415 | .header("Content-Type", "application/cbor")
|
399 416 | .header("smithy-protocol", "rpc-v2-cbor")
|
400 417 | .status(200)
|
401 418 | .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfl+AA=="))
|
402 419 | .unwrap(),
|
403 420 | )
|
404 421 | .unwrap();
|
405 422 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
406 423 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
407 424 |
|
408 425 | let op = crate::operation::float16::Float16::new();
|
409 426 | let config = op.config().expect("the operation has config");
|
410 427 | let de = config
|
411 428 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
412 429 | .expect("the config must have a deserializer");
|
413 430 |
|
414 431 | let parsed = de.deserialize_streaming(&mut http_response);
|
415 432 | let parsed = parsed.unwrap_or_else(|| {
|
416 433 | let http_response = http_response.map(|body| {
|
417 434 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
418 435 | body.bytes().unwrap(),
|
419 436 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
420 437 | )))
|
421 438 | });
|
422 - | de.deserialize_nonstreaming(&http_response)
|
439 + | // Build a config bag with the protocol for schema-based deserialization
|
440 + | #[allow(unused_mut)]
|
441 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
442 + |
|
443 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
423 444 | });
|
424 445 | let parsed = parsed
|
425 446 | .expect("should be successful response")
|
426 447 | .downcast::<crate::operation::float16::Float16Output>()
|
427 448 | .unwrap();
|
428 449 | assert!(
|
429 450 | parsed.value.float_equals(&expected_output.value),
|
430 451 | "Unexpected value for `value` {:?} vs. {:?}",
|
431 452 | expected_output.value,
|
432 453 | parsed.value
|
433 454 | );
|
434 455 | }
|
435 456 |
|
436 457 | /// Ensures that clients can correctly parse a subnormal float16.
|
437 458 | /// Test ID: RpcV2CborFloat16Subnormal
|
438 459 | #[::tokio::test]
|
439 460 | #[::tracing_test::traced_test]
|
440 461 | async fn rpc_v2_cbor_float16_subnormal_response() {
|
441 462 | let expected_output = crate::operation::float16::Float16Output::builder()
|
442 463 | .set_value(::std::option::Option::Some(4.76837158203125E-6_f64))
|
443 464 | .build();
|
444 465 | let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
|
445 466 | ::http_1x::response::Builder::new()
|
446 467 | .header("Content-Type", "application/cbor")
|
447 468 | .header("smithy-protocol", "rpc-v2-cbor")
|
448 469 | .status(200)
|
449 470 | .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1ZfkAUA=="))
|
450 471 | .unwrap(),
|
451 472 | )
|
452 473 | .unwrap();
|
453 474 | use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
|
454 475 | use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
|
455 476 |
|
456 477 | let op = crate::operation::float16::Float16::new();
|
457 478 | let config = op.config().expect("the operation has config");
|
458 479 | let de = config
|
459 480 | .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
|
460 481 | .expect("the config must have a deserializer");
|
461 482 |
|
462 483 | let parsed = de.deserialize_streaming(&mut http_response);
|
463 484 | let parsed = parsed.unwrap_or_else(|| {
|
464 485 | let http_response = http_response.map(|body| {
|
465 486 | ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
466 487 | body.bytes().unwrap(),
|
467 488 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
468 489 | )))
|
469 490 | });
|
470 - | de.deserialize_nonstreaming(&http_response)
|
491 + | // Build a config bag with the protocol for schema-based deserialization
|
492 + | #[allow(unused_mut)]
|
493 + | let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
|
494 + |
|
495 + | de.deserialize_nonstreaming(&http_response, &test_cfg)
|
471 496 | });
|
472 497 | let parsed = parsed
|
473 498 | .expect("should be successful response")
|
474 499 | .downcast::<crate::operation::float16::Float16Output>()
|
475 500 | .unwrap();
|
476 501 | assert!(
|
477 502 | parsed.value.float_equals(&expected_output.value),
|
478 503 | "Unexpected value for `value` {:?} vs. {:?}",
|
479 504 | expected_output.value,
|
480 505 | parsed.value
|