use super::*;
impl<E: Environment, I: IntegerType> CastLossy<Address<E>> for Integer<E, I> {
#[inline]
fn cast_lossy(&self) -> Address<E> {
let field: Field<E> = self.cast_lossy();
field.cast_lossy()
}
}
impl<E: Environment, I: IntegerType> CastLossy<Boolean<E>> for Integer<E, I> {
#[inline]
fn cast_lossy(&self) -> Boolean<E> {
let bits_le = self.to_bits_le();
debug_assert!(!bits_le.is_empty(), "An integer must have at least one bit");
bits_le[0].clone()
}
}
impl<E: Environment, I: IntegerType> CastLossy<Field<E>> for Integer<E, I> {
#[inline]
fn cast_lossy(&self) -> Field<E> {
self.to_field()
}
}
impl<E: Environment, I: IntegerType> CastLossy<Group<E>> for Integer<E, I> {
#[inline]
fn cast_lossy(&self) -> Group<E> {
let field: Field<E> = self.cast_lossy();
field.cast_lossy()
}
}
impl<E: Environment, I0: IntegerType, I1: IntegerType> CastLossy<Integer<E, I1>> for Integer<E, I0> {
fn cast_lossy(&self) -> Integer<E, I1> {
let mut bits_le = self.to_bits_le();
let padding = match I0::is_signed() {
true => self.msb().clone(),
false => Boolean::constant(false),
};
bits_le.resize(I1::BITS as usize, padding);
Integer::from_bits_le(&bits_le)
}
}
impl<E: Environment, I: IntegerType> CastLossy<Scalar<E>> for Integer<E, I> {
#[inline]
fn cast_lossy(&self) -> Scalar<E> {
self.to_scalar()
}
}
#[cfg(test)]
mod tests {
use super::*;
use console::CastLossy as _;
use console_root::{
network::Testnet3,
prelude::{One, TestRng, Uniform, Zero},
};
use snarkvm_circuit_types::environment::{count_is, count_less_than, Circuit, Eject, Inject, Mode, UpdatableCount};
use std::fmt::Debug;
const ITERATIONS: usize = 100;
fn sample_values<I: IntegerType>(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::integers::Integer<Testnet3, I>, Integer<Circuit, I>) {
let console_value = match i {
0 => console_root::types::integers::Integer::<Testnet3, I>::zero(),
1 => console_root::types::integers::Integer::<Testnet3, I>::one(),
2 => console_root::types::integers::Integer::<Testnet3, I>::new(I::MAX),
3 => console_root::types::integers::Integer::<Testnet3, I>::new(I::MIN),
4 if I::is_signed() => -console_root::types::integers::Integer::<Testnet3, I>::one(),
_ => Uniform::rand(rng),
};
let circuit_value = Integer::<Circuit, I>::new(mode, console_value);
(console_value, circuit_value)
}
mod i8 {
use super::*;
fn sample_values(i: usize, mode: Mode, rng: &mut TestRng) -> (console_root::types::I8<Testnet3>, I8<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, I8<Circuit>, console_root::types::I8<Testnet3>);
#[test]
fn test_i8_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i8_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i8_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i8_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i8_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i8_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i8_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i8_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod i16 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::I16<Testnet3>, I16<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, I16<Circuit>, console_root::types::I16<Testnet3>);
#[test]
fn test_i16_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i16_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i16_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i16_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i16_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i16_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i16_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i16_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod i32 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::I32<Testnet3>, I32<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, I32<Circuit>, console_root::types::I32<Testnet3>);
#[test]
fn test_i32_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i32_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i32_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i32_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i32_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i32_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i32_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i32_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod i64 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::I64<Testnet3>, I64<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, I64<Circuit>, console_root::types::I64<Testnet3>);
#[test]
fn test_i64_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i64_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i64_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i64_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i64_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i64_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i64_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i64_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod i128 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::I128<Testnet3>, I128<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, I128<Circuit>, console_root::types::I128<Testnet3>);
#[test]
fn test_i128_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i128_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i128_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i128_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_i128_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i128_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_i128_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_i128_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod u8 {
use super::*;
fn sample_values(i: usize, mode: Mode, rng: &mut TestRng) -> (console_root::types::U8<Testnet3>, U8<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, U8<Circuit>, console_root::types::U8<Testnet3>);
#[test]
fn test_u8_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u8_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u8_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u8_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u8_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u8_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u8_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u8_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod u16 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::U16<Testnet3>, U16<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, U16<Circuit>, console_root::types::U16<Testnet3>);
#[test]
fn test_u16_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u16_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u16_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u16_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u16_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u16_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u16_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u16_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod u32 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::U32<Testnet3>, U32<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, U32<Circuit>, console_root::types::U32<Testnet3>);
#[test]
fn test_u32_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u32_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u32_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u32_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u32_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u32_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u32_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u32_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod u64 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::U64<Testnet3>, U64<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, U64<Circuit>, console_root::types::U64<Testnet3>);
#[test]
fn test_u64_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u64_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u64_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u64_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u64_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u64_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u64_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u64_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
mod u128 {
use super::*;
fn sample_values(
i: usize,
mode: Mode,
rng: &mut TestRng,
) -> (console_root::types::U128<Testnet3>, U128<Circuit>) {
super::sample_values(i, mode, rng)
}
check_cast_lossy!(cast_lossy, U128<Circuit>, console_root::types::U128<Testnet3>);
#[test]
fn test_u128_to_address() {
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Address<Circuit>, console_root::types::Address<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u128_to_boolean() {
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Boolean<Circuit>, console_root::types::Boolean<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u128_to_field() {
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Field<Circuit>, console_root::types::Field<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u128_to_group() {
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Constant,
count_less_than!(551, 0, 0, 0),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Public,
count_is!(277, 0, 899, 904),
);
check_cast_lossy::<Group<Circuit>, console_root::types::Group<Testnet3>>(
Mode::Private,
count_is!(277, 0, 899, 904),
);
}
#[test]
fn test_u128_to_i8() {
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I8<Circuit>, console_root::types::I8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_i16() {
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I16<Circuit>, console_root::types::I16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_i32() {
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I32<Circuit>, console_root::types::I32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_i64() {
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I64<Circuit>, console_root::types::I64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_i128() {
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<I128<Circuit>, console_root::types::I128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u128_to_scalar() {
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Public,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<Scalar<Circuit>, console_root::types::Scalar<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
#[test]
fn test_u128_to_u8() {
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U8<Circuit>, console_root::types::U8<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_u16() {
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U16<Circuit>, console_root::types::U16<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_u32() {
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U32<Circuit>, console_root::types::U32<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_u64() {
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Constant, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U64<Circuit>, console_root::types::U64<Testnet3>>(Mode::Private, count_is!(0, 0, 0, 0));
}
#[test]
fn test_u128_to_u128() {
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Constant,
count_is!(0, 0, 0, 0),
);
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(Mode::Public, count_is!(0, 0, 0, 0));
check_cast_lossy::<U128<Circuit>, console_root::types::U128<Testnet3>>(
Mode::Private,
count_is!(0, 0, 0, 0),
);
}
}
}