pallas/pallas-codec/tests/zigzag.rs
Lucas 7fada705a0
feat: Move flat en/de from aiken to pallas (#303)
Nothing new is going on within the code itself.
I simply popped the crate into pallas_codec
as a submodule `pallas_codec::flat`. I also moved
over the tests that we had in the crate. In general
this is in solid shape and hasn't had any changes for
months. That said there could be some things that require love
like dealing with BigInt.

Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-10-04 19:08:52 -04:00

18 lines
392 B
Rust

use pallas_codec::flat::zigzag::{to_isize, to_usize};
use proptest::prelude::*;
proptest! {
#[test]
fn zigzag(i: isize) {
let u = to_usize(i);
let converted_i = to_isize(u);
assert_eq!(converted_i, i);
}
#[test]
fn zagzig(u: usize) {
let i = to_isize(u);
let converted_u = to_usize(i);
assert_eq!(converted_u, u);
}
}