public static Gen <Op> NonPushOpcode() => from b in PrimitiveGenerator.RandomByte() where Enum.IsDefined(typeof(OpcodeType), b) let op = (OpcodeType)b where !Op.IsPushCode(op) let opc = (Op)(OpcodeType)b where !opc.IsInvalid select opc;
public static Gen <Money> Money() => (from bytes in Gen.ListOf(6, PrimitiveGenerator.RandomByte()) // Make sure we are below 21M select Bitcoin3.Utils.ToUInt64(bytes.Concat(new byte[] { 0, 0 }).ToArray(), true)) .Select(u64 => new Money(u64));