| 316 | |
| 317 | #[test] |
| 318 | fn valid_time_variants_roundtrip() { |
| 319 | let s = schema(); |
| 320 | let mut b = SparseTileBuilder::new(&s); |
| 321 | b.push_row(SparseRow { |
| 322 | coord: &[CoordValue::Int64(1)], |
| 323 | attrs: &[CellValue::Int64(10)], |
| 324 | surrogate: Surrogate::ZERO, |
| 325 | valid_from_ms: 100, |
| 326 | valid_until_ms: 500, |
| 327 | kind: RowKind::Live, |
| 328 | }) |
| 329 | .unwrap(); |
| 330 | b.push_row(SparseRow { |
| 331 | coord: &[CoordValue::Int64(2)], |
| 332 | attrs: &[CellValue::Int64(20)], |
| 333 | surrogate: Surrogate::ZERO, |
| 334 | valid_from_ms: 200, |
| 335 | valid_until_ms: OPEN_UPPER, |
| 336 | kind: RowKind::Live, |
| 337 | }) |
| 338 | .unwrap(); |
| 339 | // need >=8 to get Structural |
| 340 | for i in 3..20 { |
| 341 | b.push_row(SparseRow { |
| 342 | coord: &[CoordValue::Int64(i)], |
| 343 | attrs: &[CellValue::Int64(i)], |
| 344 | surrogate: Surrogate::ZERO, |
| 345 | valid_from_ms: i * 10, |
| 346 | valid_until_ms: OPEN_UPPER, |
| 347 | kind: RowKind::Live, |
| 348 | }) |
| 349 | .unwrap(); |
| 350 | } |
| 351 | let tile = b.build(); |
| 352 | let out = roundtrip(&tile); |
| 353 | assert_eq!(out.valid_from_ms[0], 100); |
| 354 | assert_eq!(out.valid_until_ms[0], 500); |
| 355 | assert_eq!(out.valid_until_ms[1], OPEN_UPPER); |
| 356 | } |
| 357 | } |