class IntPairPropertySample is Stringable
"""
A sample holding a type choice and two integer values.
"""
let choice: U8
let int1: U128
let int2: U128
new create(choice': U8, int1': U128, int2': U128) =>
choice = choice'
int1 = int1'
int2 = int2'
fun string(): String iso^ =>
let num1: String val = _StringifyIntArg(choice, int1)
let num2: String val = _StringifyIntArg(choice, int2)
"".join(["("; num1; ", "; num2; ")"].values())
trait IntPairProperty is Property[IntPairPropertySample]
"""
Tests a property across all 14 Pony integer types with two values per
sample, dispatching each to `int_pair_property[T]`.
"""
fun gen(): Generator[IntPairPropertySample] =>
Generators.map3[U8, U128, U128, IntPairPropertySample](
Generators.u8(),
Generators.u128(),
Generators.u128(),
{(choice, int1, int2) => IntPairPropertySample(choice, int1, int2) })
fun ref property(sample: IntPairPropertySample, h: PropertyHelper) ? =>
let x = sample.int1
let y = sample.int2
match sample.choice % 14
| 0 => int_property[U8](x.u8(), y.u8(), h)?
| 1 => int_property[U16](x.u16(), y.u16(), h)?
| 2 => int_property[U32](x.u32(), y.u32(), h)?
| 3 => int_property[U64](x.u64(), y.u64(), h)?
| 4 => int_property[ULong](x.ulong(), y.ulong(), h)?
| 5 => int_property[USize](x.usize(), y.usize(), h)?
| 6 => int_property[U128](x, y, h)?
| 7 => int_property[I8](x.i8(), y.i8(), h)?
| 8 => int_property[I16](x.i16(), y.i16(), h)?
| 9 => int_property[I32](x.i32(), y.i32(), h)?
| 10 => int_property[I64](x.i64(), y.i64(), h)?
| 11 => int_property[ILong](x.ilong(), y.ilong(), h)?
| 12 => int_property[ISize](x.isize(), y.isize(), h)?
| 13 => int_property[I128](x.i128(), y.i128(), h)?
else
h.log("rem is broken")
error
end
fun ref int_property[T: (Int & Integer[T] val)](
x: T,
y: T,
h: PropertyHelper)
?
"""
The property to verify for the given integer pair.
"""