Exemplo n.º 1
0
def test_attribute_entity():
    assert is_satisfiable(
        BASE_PROGRAMS + ["entity(mark,root,0).", "attribute((mark,type),0,bar)."]
    )
    assert not is_satisfiable(
        BASE_PROGRAMS + ["entity(invalid,root,0).", "attribute((mark,type),0,bar)."]
    )
Exemplo n.º 2
0
def test_domain_invlid():
    assert not is_satisfiable(BASE_PROGRAMS + ["attribute((mark,type),0,invalid)."])
    assert not is_satisfiable(BASE_PROGRAMS + ["attribute((scale,type),0,invalid)."])
    assert not is_satisfiable(BASE_PROGRAMS + ["attribute((scale,channel),0,invalid)."])
    assert not is_satisfiable(
        BASE_PROGRAMS + ["attribute((encoding,channel),0,invalid)."]
    )
Exemplo n.º 3
0
def test_duplicate_attribute():
    assert is_satisfiable(
        BASE_PROGRAMS
        + ["attribute((mark,type),0,bar).", "attribute((mark,type),1,line)."]
    )
    assert not is_satisfiable(
        BASE_PROGRAMS
        + ["attribute((mark,type),0,bar).", "attribute((mark,type),0,line)."]
    )
Exemplo n.º 4
0
def test_text_mark_without_text_channel():
    b = hard.blocks["text_mark_without_text_channel"]
    assert isinstance(b, Block)
    p = helpers.program + b.program

    assert is_satisfiable(p + """
    attribute(mark_type,m1,text).
    entity(encoding,m1,e1).
    attribute(channel,e1,text).

    :- violation(_).
    """)

    assert is_satisfiable(p + """
    attribute(mark_type,m1,text).
    entity(encoding,m1,e1).
    attribute(channel,e1,x).
    entity(encoding,m1,e2).
    attribute(channel,e2,text).

    :- violation(_).
    """)

    assert not is_satisfiable(p + """
    attribute(mark_type,m1,text).
    entity(encoding,m1,e1).
    attribute(channel,e1,x).
    entity(encoding,m1,e2).
    attribute(channel,e2,y).

    :- violation(_).
    """)

    assert not is_satisfiable(p + """
    attribute(mark_type,m1,text).
    entity(encoding,m1,e1).
    attribute(channel,e1,x).
    entity(encoding,m1,e2).
    attribute(channel,e2,y).
    attribute(channel,e3,text).

    :- violation(_).
    """)
Exemplo n.º 5
0
def test_domain_valid():
    assert is_satisfiable(BASE_PROGRAMS + ["attribute((mark,type),0,bar)."])
    assert is_satisfiable(BASE_PROGRAMS + ["attribute((scale,type),0,linear)."])
    assert is_satisfiable(BASE_PROGRAMS + ["attribute((scale,channel),0,x)."])
    assert is_satisfiable(BASE_PROGRAMS + ["attribute((encoding,channel),0,x)."])
Exemplo n.º 6
0
def test_fields():
    assert is_satisfiable(
        BASE_PROGRAMS
        + ["attribute((field,name),0,foo).", "attribute((encoding,field),1,foo)."]
    )
    assert not is_satisfiable(BASE_PROGRAMS + ["attribute((encoding,field),0,foo)."])