Beispiel #1
0
def test_gaid():
    expr = pt.GeneratedID(0)
    assert expr.type_of() == pt.TealType.uint64

    expected = pt.TealSimpleBlock([pt.TealOp(expr, pt.Op.gaid, 0)])

    actual, _ = expr.__teal__(avm4Options)

    assert actual == expected
Beispiel #2
0
def test_gaid_dynamic():
    arg = pt.Int(0)
    expr = pt.GeneratedID(arg)
    assert expr.type_of() == pt.TealType.uint64

    expected = pt.TealSimpleBlock(
        [pt.TealOp(arg, pt.Op.int, 0),
         pt.TealOp(expr, pt.Op.gaids)])

    actual, _ = expr.__teal__(avm4Options)
    actual.addIncoming()
    actual = pt.TealBlock.NormalizeBlocks(actual)

    assert actual == expected
Beispiel #3
0
def test_gaid_teal_3():
    with pytest.raises(pt.TealInputError):
        pt.GeneratedID(0).__teal__(avm3Options)
Beispiel #4
0
def test_gaid_dynamic_invalid():
    with pytest.raises(pt.TealTypeError):
        pt.GeneratedID(pt.Bytes("index"))
Beispiel #5
0
def test_gaid_invalid():
    with pytest.raises(pt.TealInputError):
        pt.GeneratedID(-1)

    with pytest.raises(pt.TealInputError):
        pt.GeneratedID(pt.MAX_GROUP_SIZE)