()
| 1407 | |
| 1408 | #[test] |
| 1409 | fn set_new_epoch() { |
| 1410 | let mut log = Generic::<_, [u8; 32]>::open(repo::Memory::unlimited(), <_>::default()).unwrap(); |
| 1411 | assert_eq!(log.epoch(), Commit::DEFAULT_EPOCH); |
| 1412 | log.commit([(0, [12; 32])]).unwrap(); |
| 1413 | log.set_epoch(42).unwrap(); |
| 1414 | assert_eq!(log.epoch(), 42); |
| 1415 | log.commit([(1, [13; 32])]).unwrap(); |
| 1416 | |
| 1417 | log.flush_and_sync().unwrap(); |
| 1418 | |
| 1419 | let epochs = log |
| 1420 | .commits_from(0) |
| 1421 | .map(Result::unwrap) |
| 1422 | .map(|commit| commit.epoch) |
| 1423 | .collect::<Vec<_>>(); |
| 1424 | assert_eq!(&[Commit::DEFAULT_EPOCH, 42], epochs.as_slice()); |
| 1425 | } |
| 1426 | |
| 1427 | #[test] |
| 1428 | fn set_lower_epoch_returns_error() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…