()
| 410 | #[test] |
| 411 | #[ignore] |
| 412 | fn test_simple_struct() { |
| 413 | let data_file_path = get_data_file(); |
| 414 | let bytes = fs::read(&data_file_path).unwrap(); |
| 415 | let mut fory = Fory::builder().compatible(true).xlang(true).build(); |
| 416 | fory.register::<Color>(101).unwrap(); |
| 417 | fory.register::<Item>(102).unwrap(); |
| 418 | fory.register::<SimpleStruct>(103).unwrap(); |
| 419 | |
| 420 | let local_obj = SimpleStruct { |
| 421 | f1: HashMap::from([(1, 1.0f64), (2, 2.0f64)]), |
| 422 | f2: 39, |
| 423 | f3: Item { |
| 424 | name: "item".to_string(), |
| 425 | }, |
| 426 | f4: "f4".to_string(), |
| 427 | f5: Color::White, |
| 428 | f6: vec!["f6".to_string()], |
| 429 | f7: 40, |
| 430 | f8: 41, |
| 431 | last: 42, |
| 432 | }; |
| 433 | let remote_obj: SimpleStruct = fory.deserialize(&bytes).unwrap(); |
| 434 | assert_eq!(remote_obj, local_obj); |
| 435 | let new_bytes = fory.serialize(&remote_obj).unwrap(); |
| 436 | let new_local_obj: SimpleStruct = fory.deserialize(&new_bytes).unwrap(); |
| 437 | assert_eq!(new_local_obj, local_obj); |
| 438 | fs::write(&data_file_path, new_bytes).unwrap(); |
| 439 | } |
| 440 | |
| 441 | #[test] |
| 442 | #[ignore] |
nothing calls this directly
no test coverage detected