()
| 470 | |
| 471 | #[mz_ore::test] |
| 472 | fn validate() { |
| 473 | let value_schema_valid = vec![ |
| 474 | (Value::Int(42), "\"int\"", true), |
| 475 | (Value::Int(42), "\"boolean\"", false), |
| 476 | ( |
| 477 | Value::Union { |
| 478 | index: 0, |
| 479 | inner: Box::new(Value::Null), |
| 480 | n_variants: 2, |
| 481 | null_variant: Some(0), |
| 482 | }, |
| 483 | r#"["null", "int"]"#, |
| 484 | true, |
| 485 | ), |
| 486 | ( |
| 487 | Value::Union { |
| 488 | index: 1, |
| 489 | inner: Box::new(Value::Int(42)), |
| 490 | n_variants: 2, |
| 491 | null_variant: Some(0), |
| 492 | }, |
| 493 | r#"["null", "int"]"#, |
| 494 | true, |
| 495 | ), |
| 496 | ( |
| 497 | Value::Union { |
| 498 | index: 1, |
| 499 | inner: Box::new(Value::Null), |
| 500 | n_variants: 2, |
| 501 | null_variant: Some(1), |
| 502 | }, |
| 503 | r#"["double", "int"]"#, |
| 504 | false, |
| 505 | ), |
| 506 | ( |
| 507 | Value::Union { |
| 508 | index: 3, |
| 509 | inner: Box::new(Value::Int(42)), |
| 510 | n_variants: 4, |
| 511 | null_variant: Some(0), |
| 512 | }, |
| 513 | r#"["null", "double", "string", "int"]"#, |
| 514 | true, |
| 515 | ), |
| 516 | ( |
| 517 | Value::Array(vec![Value::Long(42i64)]), |
| 518 | r#"{"type": "array", "items": "long"}"#, |
| 519 | true, |
| 520 | ), |
| 521 | ( |
| 522 | Value::Array(vec![Value::Boolean(true)]), |
| 523 | r#"{"type": "array", "items": "long"}"#, |
| 524 | false, |
| 525 | ), |
| 526 | (Value::Record(vec![]), "\"null\"", false), |
| 527 | ]; |
| 528 | |
| 529 | for (value, schema_str, valid) in value_schema_valid.into_iter() { |
no test coverage detected