"""
Contains a dictionary with all clintest tests for preprocessing
and the corresponding files (usually corresponds to "testname.lp")or programs they should be run with.

The key of the dictionary corresponds to the name of the test.

All tests run with clingo.
"""

# pylint: disable=line-too-long, too-many-lines
from typing import Any

from .. import get_model_from_file
from . import TEST_EMPTY, StableModels, Supersets

TESTS_PREPROCESS: dict[str, dict[str, Any]] = {
    "empty": {"test": TEST_EMPTY, "program": ""},
    "empty_product": {
        "test": StableModels({'part("product")', 'type("root","product")'}),
        "program": 'coom_structure("product").',
    },
    "structure_mandatory": {
        "test": StableModels(
            {
                'part("product")',
                'part("Wheel")',
                'constraint(("root.wheel",1),"lowerbound")',
                'index("root.wheel[0]",0)',
                'parent("root.wheel[0]","root")',
                'set("root.wheel","root.wheel[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","wheel","Wheel",1,1).
            coom_structure("Wheel").""",
    },
    "structure_optional": {
        "test": StableModels(
            {
                'part("product")',
                'part("Wheel")',
                'constraint(("root.wheel",0),"lowerbound")',
                'index("root.wheel[0]",0)',
                'parent("root.wheel[0]","root")',
                'set("root.wheel","root.wheel[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","wheel","Wheel",0,1).
            coom_structure("Wheel").""",
    },
    "structure_nested": {
        "test": StableModels(
            {
                'part("product")',
                'part("Carrier")',
                'part("Bag")',
                'constraint(("root.carrier",1),"lowerbound")',
                'constraint(("root.carrier[0].bag",1),"lowerbound")',
                'index("root.carrier[0]",0)',
                'index("root.carrier[0].bag[0]",0)',
                'parent("root.carrier[0]","root")',
                'parent("root.carrier[0].bag[0]","root.carrier[0]")',
                'set("root.carrier","root.carrier[0]")',
                'set("root.carrier[0].bag","root.carrier[0].bag[0]")',
                'type("root","product")',
                'type("root.carrier[0]","Carrier")',
                'type("root.carrier[0].bag[0]","Bag")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","carrier","Carrier",1,1).
            coom_structure("Carrier").
            coom_feature("Carrier","bag","Bag",1,1).
            coom_structure("Bag").""",
    },
    "structure_nested_optional": {
        "test": StableModels(
            {
                'part("product")',
                'part("Carrier")',
                'part("Bag")',
                'constraint(("root.carrier",0),"lowerbound")',
                'constraint(("root.carrier[0].bag",0),"lowerbound")',
                'index("root.carrier[0]",0)',
                'index("root.carrier[0].bag[0]",0)',
                'index("root.carrier[0].bag[1]",1)',
                'parent("root.carrier[0]","root")',
                'parent("root.carrier[0].bag[0]","root.carrier[0]")',
                'parent("root.carrier[0].bag[1]","root.carrier[0]")',
                'set("root.carrier","root.carrier[0]")',
                'set("root.carrier[0].bag","root.carrier[0].bag[0]")',
                'set("root.carrier[0].bag","root.carrier[0].bag[1]")',
                'type("root","product")',
                'type("root.carrier[0]","Carrier")',
                'type("root.carrier[0].bag[0]","Bag")',
                'type("root.carrier[0].bag[1]","Bag")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","carrier","Carrier",0,1).
            coom_structure("Carrier").
            coom_feature("Carrier","bag","Bag",0,2).
            coom_structure("Bag").""",
    },
    "enumeration": {
        "test": StableModels(
            {
                'discrete("Color")',
                'part("product")',
                'constraint(("root.color",1),"lowerbound")',
                'domain("Color","Red")',
                'domain("Color","Green")',
                'domain("Color","Blue")',
                'index("root.color[0]",0)',
                'parent("root.color[0]","root")',
                'set("root.color","root.color[0]")',
                'type("root","product")',
                'type("root.color[0]","Color")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","color","Color",1,1).
            coom_enumeration("Color").
            coom_option("Color", "Red").
            coom_option("Color", "Green").
            coom_option("Color", "Blue").""",
    },
    "bool_enumeration": {
        "test": StableModels(
            {
                'discrete("Bool")',
                'part("product")',
                'constraint(("root.boolean",1),"lowerbound")',
                'domain("Bool","True")',
                'domain("Bool","False")',
                'index("root.boolean[0]",0)',
                'parent("root.boolean[0]","root")',
                'set("root.boolean","root.boolean[0]")',
                'type("root","product")',
                'type("root.boolean[0]","Bool")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","boolean","Bool",1,1).""",
    },
    "attribute": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'integer("Wheel.size")',
                'part("product")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("Wheel","root.wheel[0]"),"table")',
                'domain("Wheel","W14")',
                'index("root.wheel[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[0].size[0]","Wheel.size")',
                'allow("Wheel",(0,0),"W14")',
                'allow("Wheel",(1,0),14)',
                'range("Wheel.size",14,14)',
                'column(("Wheel","root.wheel[0]"),0,1,"root.wheel[0].size[0]")',
                'column(("Wheel","root.wheel[0]"),0,0,"root.wheel[0]")',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","wheel","Wheel",1,1).
            coom_enumeration("Wheel").
            coom_attribute("Wheel","size","num").
            coom_option("Wheel", "W14").
            coom_attribute_value("Wheel","W14","size",14).""",
    },
    "require_undef": {
        "test": StableModels({'constant("Silver")', 'part("product")', 'type("root","product")'}),
        "program": """
            coom_structure("product").

            coom_behavior(("product",0)).
            coom_require(("product",0),"color=Silver").
            coom_binary("color=Silver","color","=","Silver").
            coom_path("color",0,"color").
            coom_constant("Silver").""",
    },
    "require_with_number": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'integer("Wheel.size")',
                'part("product")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("Wheel","root.wheel[0]"),"table")',
                'constraint((0,"root.wheel[0].size[0]=27"),"boolean")',
                'domain("Wheel","W27")',
                'domain("Wheel","W28")',
                'index("root.wheel[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'number("27",27)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[0].size[0]","Wheel.size")',
                'allow("Wheel",(0,0),"W27")',
                'allow("Wheel",(0,1),"W28")',
                'allow("Wheel",(1,1),28)',
                'allow("Wheel",(1,0),27)',
                'range("Wheel.size",27,28)',
                'binary("root.wheel[0].size[0]=27","root.wheel[0].size[0]","=","27")',
                'column(("Wheel","root.wheel[0]"),0,1,"root.wheel[0].size[0]")',
                'column(("Wheel","root.wheel[0]"),0,0,"root.wheel[0]")',
            }
        ),
    },
    "require_with_number_ge": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'integer("Wheel.size")',
                'part("product")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("Wheel","root.wheel[0]"),"table")',
                'constraint((0,"root.wheel[0].size[0]>=28"),"boolean")',
                'domain("Wheel","W27")',
                'domain("Wheel","W28")',
                'index("root.wheel[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'number("28",28)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[0].size[0]","Wheel.size")',
                'allow("Wheel",(0,0),"W27")',
                'allow("Wheel",(0,1),"W28")',
                'allow("Wheel",(1,1),28)',
                'allow("Wheel",(1,0),27)',
                'range("Wheel.size",27,28)',
                'binary("root.wheel[0].size[0]>=28","root.wheel[0].size[0]",">=","28")',
                'column(("Wheel","root.wheel[0]"),0,1,"root.wheel[0].size[0]")',
                'column(("Wheel","root.wheel[0]"),0,0,"root.wheel[0]")',
            }
        ),
    },
    "require_with_constant": {
        "test": StableModels(
            {
                'constant("W28")',
                'discrete("Wheel")',
                'part("product")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint((0,"root.wheel[0]=W28"),"boolean")',
                'domain("Wheel","W27")',
                'domain("Wheel","W28")',
                'index("root.wheel[0]",0)',
                'parent("root.wheel[0]","root")',
                'set("root.wheel","root.wheel[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'binary("root.wheel[0]=W28","root.wheel[0]","=","W28")',
            }
        ),
    },
    "require_two_wheels": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'integer("Wheel.size")',
                'part("product")',
                'constraint(("root.frontWheel",1),"lowerbound")',
                'constraint(("root.rearWheel",1),"lowerbound")',
                'constraint(("root.frontWheel[0].size",1),"lowerbound")',
                'constraint(("root.rearWheel[0].size",1),"lowerbound")',
                'constraint(("Wheel","root.frontWheel[0]"),"table")',
                'constraint(("Wheel","root.rearWheel[0]"),"table")',
                'constraint((0,"root.frontWheel[0].size[0]=root.rearWheel[0].size[0]"),"boolean")',
                'domain("Wheel","W27")',
                'domain("Wheel","W28")',
                'index("root.frontWheel[0]",0)',
                'index("root.rearWheel[0]",0)',
                'index("root.rearWheel[0].size[0]",0)',
                'index("root.frontWheel[0].size[0]",0)',
                'parent("root.frontWheel[0]","root")',
                'parent("root.rearWheel[0]","root")',
                'parent("root.rearWheel[0].size[0]","root.rearWheel[0]")',
                'parent("root.frontWheel[0].size[0]","root.frontWheel[0]")',
                'set("root.frontWheel","root.frontWheel[0]")',
                'set("root.rearWheel","root.rearWheel[0]")',
                'set("root.frontWheel[0].size","root.frontWheel[0].size[0]")',
                'set("root.rearWheel[0].size","root.rearWheel[0].size[0]")',
                'type("root","product")',
                'type("root.frontWheel[0]","Wheel")',
                'type("root.rearWheel[0]","Wheel")',
                'type("root.frontWheel[0].size[0]","Wheel.size")',
                'type("root.rearWheel[0].size[0]","Wheel.size")',
                'allow("Wheel",(0,0),"W27")',
                'allow("Wheel",(0,1),"W28")',
                'allow("Wheel",(1,1),28)',
                'allow("Wheel",(1,0),27)',
                'range("Wheel.size",27,28)',
                'binary("root.frontWheel[0].size[0]=root.rearWheel[0].size[0]","root.frontWheel[0].size[0]","=","root.rearWheel[0].size[0]")',
                'column(("Wheel","root.frontWheel[0]"),0,1,"root.frontWheel[0].size[0]")',
                'column(("Wheel","root.rearWheel[0]"),0,1,"root.rearWheel[0].size[0]")',
                'column(("Wheel","root.frontWheel[0]"),0,0,"root.frontWheel[0]")',
                'column(("Wheel","root.rearWheel[0]"),0,0,"root.rearWheel[0]")',
            }
        ),
    },
    "conditional_require": {
        "test": StableModels(
            {
                'constant("True")',
                'constant("Small")',
                'discrete("Wheel")',
                'discrete("Bool")',
                'part("product")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint(("root.wheelSupport",1),"lowerbound")',
                'constraint((0,"!root.wheelSupport[0]=True||root.wheel[0]=Small"),"boolean")',
                'domain("Wheel","Small")',
                'domain("Wheel","Large")',
                'domain("Bool","True")',
                'domain("Bool","False")',
                'index("root.wheel[0]",0)',
                'index("root.wheelSupport[0]",0)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheelSupport[0]","root")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheelSupport","root.wheelSupport[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheelSupport[0]","Bool")',
                'unary("!root.wheelSupport[0]=True","!","root.wheelSupport[0]=True")',
                'binary("root.wheel[0]=Small","root.wheel[0]","=","Small")',
                'binary("root.wheelSupport[0]=True","root.wheelSupport[0]","=","True")',
                'binary("!root.wheelSupport[0]=True||root.wheel[0]=Small","!root.wheelSupport[0]=True","||","root.wheel[0]=Small")',
            }
        ),
    },
    "multiple_conditions": {
        "test": StableModels(
            {
                'discrete("Color")',
                'discrete("Size")',
                'discrete("Material")',
                'domain("Color","Red")',
                'domain("Color","Green")',
                'domain("Size","Small")',
                'domain("Size","Medium")',
                'domain("Material","Cotton")',
                'domain("Material","Polyester")',
                'type("root","product")',
                'type("root.color[0]","Color")',
                'type("root.size[0]","Size")',
                'type("root.material[0]","Material")',
                'index("root.color[0]",0)',
                'index("root.size[0]",0)',
                'index("root.material[0]",0)',
                'parent("root.color[0]","root")',
                'parent("root.size[0]","root")',
                'parent("root.material[0]","root")',
                'constraint(("root.color",1),"lowerbound")',
                'constraint(("root.size",1),"lowerbound")',
                'constraint(("root.material",1),"lowerbound")',
                'constraint((0,"!(root.size[0]=Small&&root.material[0]=Cotton)||root.color[0]=Red"),"boolean")',
                'binary("root.color[0]=Red","root.color[0]","=","Red")',
                'binary("root.material[0]=Cotton","root.material[0]","=","Cotton")',
                'binary("root.size[0]=Small","root.size[0]","=","Small")',
                'binary("root.size[0]=Small&&root.material[0]=Cotton","root.size[0]=Small","&&","root.material[0]=Cotton")',
                'binary("!(root.size[0]=Small&&root.material[0]=Cotton)||root.color[0]=Red","!(root.size[0]=Small&&root.material[0]=Cotton)","||","root.color[0]=Red")',
                'unary("(root.size[0]=Small&&root.material[0]=Cotton)","()","root.size[0]=Small&&root.material[0]=Cotton")',
                'unary("!(root.size[0]=Small&&root.material[0]=Cotton)","!","(root.size[0]=Small&&root.material[0]=Cotton)")',
                'set("root.color","root.color[0]")',
                'set("root.size","root.size[0]")',
                'set("root.material","root.material[0]")',
                'part("product")',
                'constant("Small")',
                'constant("Cotton")',
                'constant("Red")',
            }
        ),
    },
    "require_with_optional_part": {
        "test": StableModels(
            {
                'integer("A.b")',
                'range("A.b",1,2)',
                'type("root","product")',
                'type("root.a[0]","A")',
                'type("root.a[0].b[0]","A.b")',
                'index("root.a[0]",0)',
                'index("root.a[0].b[0]",0)',
                'parent("root.a[0]","root")',
                'parent("root.a[0].b[0]","root.a[0]")',
                'constraint(("root.a",0),"lowerbound")',
                'constraint(("root.a[0].b",1),"lowerbound")',
                'constraint((0,"!count(root.a[0])=1||sum(root.a[0].b)>1"),"boolean")',
                'function("sum(root.a[0].b)","sum","root.a[0].b")',
                'function("count(root.a[0])","count","root.a[0]")',
                'set("root.a","root.a[0]")',
                'set("root.a[0].b","root.a[0].b[0]")',
                'set("root.a[0]","root.a[0]")',
                'binary("sum(root.a[0].b)>1","sum(root.a[0].b)",">","1")',
                'binary("count(root.a[0])=1","count(root.a[0])","=","1")',
                'binary("!count(root.a[0])=1||sum(root.a[0].b)>1","!count(root.a[0])=1","||","sum(root.a[0].b)>1")',
                'number("1",1)',
                'unary("!count(root.a[0])=1","!","count(root.a[0])=1")',
                'part("product")',
                'part("A")',
            }
        ),
    },
    "conditional_require_undef": {
        "test": StableModels(
            {
                'constant("Silver")',
                'constant("Big")',
                'discrete("Size")',
                'part("product")',
                'constraint(("root.Size",1),"lowerbound")',
                'domain("Size","Small")',
                'domain("Size","Big")',
                'index("root.Size[0]",0)',
                'parent("root.Size[0]","root")',
                'set("root.Size","root.Size[0]")',
                'type("root","product")',
                'type("root.Size[0]","size")',
            }
        ),
    },
    "require_multiple_instances": {
        "test": StableModels(
            {
                'constant("W28")',
                'discrete("Size")',
                'part("product")',
                'part("Wheel")',
                'constraint(("root.wheel",2),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("root.wheel[1].size",1),"lowerbound")',
                'constraint((0,"root.wheel[0].size[0]=W28"),"boolean")',
                'constraint((0,"root.wheel[1].size[0]=W28"),"boolean")',
                'domain("Size","W27")',
                'domain("Size","W28")',
                'index("root.wheel[0]",0)',
                'index("root.wheel[1]",1)',
                'index("root.wheel[1].size[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[1]","root")',
                'parent("root.wheel[1].size[0]","root.wheel[1]")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel","root.wheel[1]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'set("root.wheel[1].size","root.wheel[1].size[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[1]","Wheel")',
                'type("root.wheel[1].size[0]","Size")',
                'type("root.wheel[0].size[0]","Size")',
                'binary("root.wheel[1].size[0]=W28","root.wheel[1].size[0]","=","W28")',
                'binary("root.wheel[0].size[0]=W28","root.wheel[0].size[0]","=","W28")',
            }
        ),
    },
    "require_with_partonomy": {
        "test": StableModels(
            {
                'constant("Red")',
                'discrete("Color")',
                'part("product")',
                'part("Basket")',
                'constraint(("root.basket",1),"lowerbound")',
                'constraint(("root.basket[0].color",1),"lowerbound")',
                'constraint((0,"!count(root.basket[0])=1||root.basket[0].color[0]=Red"),"boolean")',
                'domain("Color","Red")',
                'domain("Color","Yellow")',
                'index("root.basket[0]",0)',
                'index("root.basket[0].color[0]",0)',
                'parent("root.basket[0]","root")',
                'parent("root.basket[0].color[0]","root.basket[0]")',
                'set("root.basket","root.basket[0]")',
                'set("root.basket[0].color","root.basket[0].color[0]")',
                'type("root","product")',
                'type("root.basket[0]","Basket")',
                'type("root.basket[0].color[0]","Color")',
                'binary("root.basket[0].color[0]=Red","root.basket[0].color[0]","=","Red")',
                'binary("!count(root.basket[0])=1||root.basket[0].color[0]=Red","!count(root.basket[0])=1","||","root.basket[0].color[0]=Red")',
                'unary("!count(root.basket[0])=1","!","count(root.basket[0])=1")',
                'binary("count(root.basket[0])=1","count(root.basket[0])","=","1")',
                'function("count(root.basket[0])","count","root.basket[0]")',
                'set("root.basket[0]","root.basket[0]")',
                'number("1",1)',
            }
        ),
    },
    "require_with_partonomy2": {
        "test": StableModels(
            {
                'constant("Red")',
                'discrete("Color")',
                'part("product")',
                'part("Bag")',
                'constraint(("root.bag",2),"lowerbound")',
                'constraint(("root.bag[0].color",1),"lowerbound")',
                'constraint(("root.bag[1].color",1),"lowerbound")',
                'constraint((0,"!count(root.bag[0])=1||root.bag[0].color[0]=Red"),"boolean")',
                'constraint((0,"!count(root.bag[1])=1||root.bag[1].color[0]=Red"),"boolean")',
                'domain("Color","Red")',
                'domain("Color","Yellow")',
                'index("root.bag[0]",0)',
                'index("root.bag[1]",1)',
                'index("root.bag[1].color[0]",0)',
                'index("root.bag[0].color[0]",0)',
                'number("1",1)',
                'parent("root.bag[0]","root")',
                'parent("root.bag[1]","root")',
                'parent("root.bag[1].color[0]","root.bag[1]")',
                'parent("root.bag[0].color[0]","root.bag[0]")',
                'set("root.bag","root.bag[0]")',
                'set("root.bag","root.bag[1]")',
                'set("root.bag[0].color","root.bag[0].color[0]")',
                'set("root.bag[1].color","root.bag[1].color[0]")',
                'set("root.bag[0]","root.bag[0]")',
                'set("root.bag[1]","root.bag[1]")',
                'type("root","product")',
                'type("root.bag[0]","Bag")',
                'type("root.bag[1]","Bag")',
                'type("root.bag[1].color[0]","Color")',
                'type("root.bag[0].color[0]","Color")',
                'function("count(root.bag[0])","count","root.bag[0]")',
                'function("count(root.bag[1])","count","root.bag[1]")',
                'unary("!count(root.bag[0])=1","!","count(root.bag[0])=1")',
                'unary("!count(root.bag[1])=1","!","count(root.bag[1])=1")',
                'binary("root.bag[1].color[0]=Red","root.bag[1].color[0]","=","Red")',
                'binary("root.bag[0].color[0]=Red","root.bag[0].color[0]","=","Red")',
                'binary("count(root.bag[0])=1","count(root.bag[0])","=","1")',
                'binary("count(root.bag[1])=1","count(root.bag[1])","=","1")',
                'binary("!count(root.bag[0])=1||root.bag[0].color[0]=Red","!count(root.bag[0])=1","||","root.bag[0].color[0]=Red")',
                'binary("!count(root.bag[1])=1||root.bag[1].color[0]=Red","!count(root.bag[1])=1","||","root.bag[1].color[0]=Red")',
            }
        ),
    },
    "require_with_partonomy_multiple_instances": {
        "test": StableModels(
            {
                'constant("Red")',
                'discrete("Color")',
                'part("product")',
                'part("Compartment")',
                'part("Bag")',
                'constraint(("root.compartment",2),"lowerbound")',
                'constraint(("root.compartment[0].bag",2),"lowerbound")',
                'constraint(("root.compartment[1].bag",2),"lowerbound")',
                'constraint(("root.compartment[1].bag[0].color",1),"lowerbound")',
                'constraint(("root.compartment[1].bag[1].color",1),"lowerbound")',
                'constraint(("root.compartment[0].bag[0].color",1),"lowerbound")',
                'constraint(("root.compartment[0].bag[1].color",1),"lowerbound")',
                'constraint((0,"!count(root.compartment[0])=1||root.compartment[0].bag[0].color[0]=Red"),"boolean")',
                'constraint((0,"!count(root.compartment[0])=1||root.compartment[0].bag[1].color[0]=Red"),"boolean")',
                'constraint((0,"!count(root.compartment[1])=1||root.compartment[1].bag[0].color[0]=Red"),"boolean")',
                'constraint((0,"!count(root.compartment[1])=1||root.compartment[1].bag[1].color[0]=Red"),"boolean")',
                'domain("Color","Red")',
                'domain("Color","Yellow")',
                'domain("Color","Green")',
                'index("root.compartment[0]",0)',
                'index("root.compartment[1]",1)',
                'index("root.compartment[1].bag[0]",0)',
                'index("root.compartment[1].bag[1]",1)',
                'index("root.compartment[0].bag[0]",0)',
                'index("root.compartment[0].bag[1]",1)',
                'index("root.compartment[0].bag[1].color[0]",0)',
                'index("root.compartment[0].bag[0].color[0]",0)',
                'index("root.compartment[1].bag[1].color[0]",0)',
                'index("root.compartment[1].bag[0].color[0]",0)',
                'number("1",1)',
                'parent("root.compartment[0]","root")',
                'parent("root.compartment[1]","root")',
                'parent("root.compartment[1].bag[0]","root.compartment[1]")',
                'parent("root.compartment[1].bag[1]","root.compartment[1]")',
                'parent("root.compartment[0].bag[0]","root.compartment[0]")',
                'parent("root.compartment[0].bag[1]","root.compartment[0]")',
                'parent("root.compartment[0].bag[1].color[0]","root.compartment[0].bag[1]")',
                'parent("root.compartment[0].bag[0].color[0]","root.compartment[0].bag[0]")',
                'parent("root.compartment[1].bag[1].color[0]","root.compartment[1].bag[1]")',
                'parent("root.compartment[1].bag[0].color[0]","root.compartment[1].bag[0]")',
                'set("root.compartment","root.compartment[0]")',
                'set("root.compartment","root.compartment[1]")',
                'set("root.compartment[0].bag","root.compartment[0].bag[0]")',
                'set("root.compartment[0].bag","root.compartment[0].bag[1]")',
                'set("root.compartment[1].bag","root.compartment[1].bag[0]")',
                'set("root.compartment[1].bag","root.compartment[1].bag[1]")',
                'set("root.compartment[1].bag[0].color","root.compartment[1].bag[0].color[0]")',
                'set("root.compartment[1].bag[1].color","root.compartment[1].bag[1].color[0]")',
                'set("root.compartment[0].bag[0].color","root.compartment[0].bag[0].color[0]")',
                'set("root.compartment[0].bag[1].color","root.compartment[0].bag[1].color[0]")',
                'set("root.compartment[0]","root.compartment[0]")',
                'set("root.compartment[1]","root.compartment[1]")',
                'type("root","product")',
                'type("root.compartment[0]","Compartment")',
                'type("root.compartment[1]","Compartment")',
                'type("root.compartment[1].bag[0]","Bag")',
                'type("root.compartment[1].bag[1]","Bag")',
                'type("root.compartment[0].bag[0]","Bag")',
                'type("root.compartment[0].bag[1]","Bag")',
                'type("root.compartment[0].bag[1].color[0]","Color")',
                'type("root.compartment[0].bag[0].color[0]","Color")',
                'type("root.compartment[1].bag[1].color[0]","Color")',
                'type("root.compartment[1].bag[0].color[0]","Color")',
                'function("count(root.compartment[0])","count","root.compartment[0]")',
                'function("count(root.compartment[1])","count","root.compartment[1]")',
                'unary("!count(root.compartment[0])=1","!","count(root.compartment[0])=1")',
                'unary("!count(root.compartment[1])=1","!","count(root.compartment[1])=1")',
                'binary("root.compartment[1].bag[1].color[0]=Red","root.compartment[1].bag[1].color[0]","=","Red")',
                'binary("root.compartment[1].bag[0].color[0]=Red","root.compartment[1].bag[0].color[0]","=","Red")',
                'binary("root.compartment[0].bag[1].color[0]=Red","root.compartment[0].bag[1].color[0]","=","Red")',
                'binary("root.compartment[0].bag[0].color[0]=Red","root.compartment[0].bag[0].color[0]","=","Red")',
                'binary("count(root.compartment[0])=1","count(root.compartment[0])","=","1")',
                'binary("count(root.compartment[1])=1","count(root.compartment[1])","=","1")',
                'binary("!count(root.compartment[0])=1||root.compartment[0].bag[0].color[0]=Red","!count(root.compartment[0])=1","||","root.compartment[0].bag[0].color[0]=Red")',
                'binary("!count(root.compartment[0])=1||root.compartment[0].bag[1].color[0]=Red","!count(root.compartment[0])=1","||","root.compartment[0].bag[1].color[0]=Red")',
                'binary("!count(root.compartment[1])=1||root.compartment[1].bag[0].color[0]=Red","!count(root.compartment[1])=1","||","root.compartment[1].bag[0].color[0]=Red")',
                'binary("!count(root.compartment[1])=1||root.compartment[1].bag[1].color[0]=Red","!count(root.compartment[1])=1","||","root.compartment[1].bag[1].color[0]=Red")',
            }
        ),
    },
    "combination": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'discrete("Bool")',
                'part("product")',
                'constraint(("root.wheelSupport",1),"lowerbound")',
                'constraint(("root.wheel",1),"lowerbound")',
                'constraint((0,"root"),"table")',
                'domain("Wheel","W14")',
                'domain("Wheel","W16")',
                'domain("Wheel","W18")',
                'domain("Wheel","W20")',
                'domain("Bool","True")',
                'domain("Bool","False")',
                'index("root.wheelSupport[0]",0)',
                'index("root.wheel[0]",0)',
                'parent("root.wheelSupport[0]","root")',
                'parent("root.wheel[0]","root")',
                'set("root.wheelSupport","root.wheelSupport[0]")',
                'set("root.wheel","root.wheel[0]")',
                'type("root","product")',
                'type("root.wheelSupport[0]","Bool")',
                'type("root.wheel[0]","Wheel")',
                'allow(0,(0,0),"True")',
                'allow(0,(1,0),"W14")',
                'allow(0,(1,0),"W16")',
                'allow(0,(0,1),"False")',
                'allow(0,(1,1),"W18")',
                'allow(0,(1,1),"W20")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[0]",())),0,"root.wheelSupport[0]")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[0]",())),1,"root.wheel[0]")',
            }
        ),
    },
    "combination_with_structure": {
        "test": StableModels(
            {
                'discrete("Size")',
                'discrete("Bool")',
                'part("product")',
                'part("Wheel")',
                'constraint(("root.wheelSupport",1),"lowerbound")',
                'constraint(("root.wheel",2),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("root.wheel[1].size",1),"lowerbound")',
                'constraint((0,"root"),"table")',
                'domain("Size","W14")',
                'domain("Size","W16")',
                'domain("Size","W18")',
                'domain("Size","W20")',
                'domain("Bool","True")',
                'domain("Bool","False")',
                'index("root.wheelSupport[0]",0)',
                'index("root.wheel[0]",0)',
                'index("root.wheel[1]",1)',
                'index("root.wheel[1].size[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'parent("root.wheelSupport[0]","root")',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[1]","root")',
                'parent("root.wheel[1].size[0]","root.wheel[1]")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'set("root.wheelSupport","root.wheelSupport[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel","root.wheel[1]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'set("root.wheel[1].size","root.wheel[1].size[0]")',
                'type("root","product")',
                'type("root.wheelSupport[0]","Bool")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[1]","Wheel")',
                'type("root.wheel[1].size[0]","Size")',
                'type("root.wheel[0].size[0]","Size")',
                'allow(0,(0,0),"True")',
                'allow(0,(1,0),"W14")',
                'allow(0,(1,0),"W16")',
                'allow(0,(0,1),"False")',
                'allow(0,(1,1),"W18")',
                'allow(0,(1,1),"W20")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[0].size[0]",())),0,"root.wheelSupport[0]")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[1].size[0]",())),0,"root.wheelSupport[0]")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[1].size[0]",())),1,"root.wheel[1].size[0]")',
                'column((0,"root"),("root.wheelSupport[0]",("root.wheel[0].size[0]",())),1,"root.wheel[0].size[0]")',
            }
        ),
    },
    "combination_at_part_with_wildcard": {
        "test": StableModels(
            {
                'discrete("Size")',
                'discrete("Material")',
                'part("product")',
                'part("Wheel")',
                'constraint(("root.wheel",2),"lowerbound")',
                'constraint(("root.wheel[0].size",1),"lowerbound")',
                'constraint(("root.wheel[1].size",1),"lowerbound")',
                'constraint(("root.wheel[0].material",1),"lowerbound")',
                'constraint(("root.wheel[1].material",1),"lowerbound")',
                'constraint((0,"root.wheel[0]"),"table")',
                'constraint((0,"root.wheel[1]"),"table")',
                'constraint((1,"root.wheel[0].size[0]=root.wheel[1].size[0]"),"boolean")',
                'constraint((1,"root.wheel[1].size[0]=root.wheel[1].size[0]"),"boolean")',
                'constraint((1,"root.wheel[0].size[0]=root.wheel[0].size[0]"),"boolean")',
                'constraint((1,"root.wheel[1].size[0]=root.wheel[0].size[0]"),"boolean")',
                'domain("Size","W28")',
                'domain("Size","W30")',
                'domain("Material","Carbon")',
                'domain("Material","Aluminum")',
                'index("root.wheel[0]",0)',
                'index("root.wheel[1]",1)',
                'index("root.wheel[1].size[0]",0)',
                'index("root.wheel[1].material[0]",0)',
                'index("root.wheel[0].size[0]",0)',
                'index("root.wheel[0].material[0]",0)',
                'parent("root.wheel[0]","root")',
                'parent("root.wheel[1]","root")',
                'parent("root.wheel[1].size[0]","root.wheel[1]")',
                'parent("root.wheel[1].material[0]","root.wheel[1]")',
                'parent("root.wheel[0].size[0]","root.wheel[0]")',
                'parent("root.wheel[0].material[0]","root.wheel[0]")',
                'set("root.wheel","root.wheel[0]")',
                'set("root.wheel","root.wheel[1]")',
                'set("root.wheel[0].size","root.wheel[0].size[0]")',
                'set("root.wheel[1].size","root.wheel[1].size[0]")',
                'set("root.wheel[0].material","root.wheel[0].material[0]")',
                'set("root.wheel[1].material","root.wheel[1].material[0]")',
                'type("root","product")',
                'type("root.wheel[0]","Wheel")',
                'type("root.wheel[1]","Wheel")',
                'type("root.wheel[1].size[0]","Size")',
                'type("root.wheel[1].material[0]","Material")',
                'type("root.wheel[0].size[0]","Size")',
                'type("root.wheel[0].material[0]","Material")',
                'allow(0,(0,0),"W28")',
                'allow(0,(0,1),"W30")',
                'allow(0,(1,1),"Aluminum")',
                'binary("root.wheel[1].size[0]=root.wheel[0].size[0]","root.wheel[1].size[0]","=","root.wheel[0].size[0]")',
                'binary("root.wheel[0].size[0]=root.wheel[0].size[0]","root.wheel[0].size[0]","=","root.wheel[0].size[0]")',
                'binary("root.wheel[1].size[0]=root.wheel[1].size[0]","root.wheel[1].size[0]","=","root.wheel[1].size[0]")',
                'binary("root.wheel[0].size[0]=root.wheel[1].size[0]","root.wheel[0].size[0]","=","root.wheel[1].size[0]")',
                'column((0,"root.wheel[1]"),("root.wheel[1].size[0]",("root.wheel[1].material[0]",())),0,"root.wheel[1].size[0]")',
                'column((0,"root.wheel[0]"),("root.wheel[0].size[0]",("root.wheel[0].material[0]",())),0,"root.wheel[0].size[0]")',
                'column((0,"root.wheel[1]"),("root.wheel[1].size[0]",("root.wheel[1].material[0]",())),1,"root.wheel[1].material[0]")',
                'column((0,"root.wheel[0]"),("root.wheel[0].size[0]",("root.wheel[0].material[0]",())),1,"root.wheel[0].material[0]")',
            }
        ),
    },
    "combination_at_part_multiple_instances": {
        "test": StableModels(
            {
                'discrete("Wheel")',
                'discrete("Material")',
                'part("product")',
                'part("Bike")',
                'constraint(("root.bike",2),"lowerbound")',
                'constraint(("root.bike[0].wheel",2),"lowerbound")',
                'constraint(("root.bike[1].wheel",2),"lowerbound")',
                'constraint(("root.bike[0].material",1),"lowerbound")',
                'constraint(("root.bike[1].material",1),"lowerbound")',
                'constraint((0,"root.bike[0]"),"table")',
                'constraint((0,"root.bike[1]"),"table")',
                # 'constraint((1,"root.bike[1].wheel[1]=root.bike[1].wheel[0]"),"boolean")',
                # 'constraint((1,"root.bike[1].wheel[0]=root.bike[1].wheel[0]"),"boolean")',
                # 'constraint((1,"root.bike[1].wheel[1]=root.bike[1].wheel[1]"),"boolean")',
                # 'constraint((1,"root.bike[1].wheel[0]=root.bike[1].wheel[1]"),"boolean")',
                # 'constraint((1,"root.bike[0].wheel[1]=root.bike[0].wheel[0]"),"boolean")',
                # 'constraint((1,"root.bike[0].wheel[0]=root.bike[0].wheel[0]"),"boolean")',
                # 'constraint((1,"root.bike[0].wheel[1]=root.bike[0].wheel[1]"),"boolean")',
                # 'constraint((1,"root.bike[0].wheel[0]=root.bike[0].wheel[1]"),"boolean")',
                'domain("Wheel","W28")',
                'domain("Wheel","W30")',
                'domain("Material","Carbon")',
                'domain("Material","Aluminum")',
                'index("root.bike[0]",0)',
                'index("root.bike[1]",1)',
                'index("root.bike[1].wheel[0]",0)',
                'index("root.bike[1].wheel[1]",1)',
                'index("root.bike[1].material[0]",0)',
                'index("root.bike[0].wheel[0]",0)',
                'index("root.bike[0].wheel[1]",1)',
                'index("root.bike[0].material[0]",0)',
                'parent("root.bike[0]","root")',
                'parent("root.bike[1]","root")',
                'parent("root.bike[1].wheel[0]","root.bike[1]")',
                'parent("root.bike[1].wheel[1]","root.bike[1]")',
                'parent("root.bike[1].material[0]","root.bike[1]")',
                'parent("root.bike[0].wheel[0]","root.bike[0]")',
                'parent("root.bike[0].wheel[1]","root.bike[0]")',
                'parent("root.bike[0].material[0]","root.bike[0]")',
                'set("root.bike","root.bike[0]")',
                'set("root.bike","root.bike[1]")',
                'set("root.bike[0].wheel","root.bike[0].wheel[0]")',
                'set("root.bike[0].wheel","root.bike[0].wheel[1]")',
                'set("root.bike[1].wheel","root.bike[1].wheel[0]")',
                'set("root.bike[1].wheel","root.bike[1].wheel[1]")',
                'set("root.bike[0].material","root.bike[0].material[0]")',
                'set("root.bike[1].material","root.bike[1].material[0]")',
                'type("root","product")',
                'type("root.bike[0]","Bike")',
                'type("root.bike[1]","Bike")',
                'type("root.bike[1].wheel[0]","Wheel")',
                'type("root.bike[1].wheel[1]","Wheel")',
                'type("root.bike[1].material[0]","Material")',
                'type("root.bike[0].wheel[0]","Wheel")',
                'type("root.bike[0].wheel[1]","Wheel")',
                'type("root.bike[0].material[0]","Material")',
                'allow(0,(0,0),"W28")',
                'allow(0,(1,0),"Carbon")',
                'allow(0,(0,1),"W30")',
                'allow(0,(1,1),"Aluminum")',
                # 'binary("root.bike[0].wheel[0]=root.bike[0].wheel[1]","root.bike[0].wheel[0]","=","root.bike[0].wheel[1]")',
                # 'binary("root.bike[0].wheel[1]=root.bike[0].wheel[1]","root.bike[0].wheel[1]","=","root.bike[0].wheel[1]")',
                # 'binary("root.bike[0].wheel[0]=root.bike[0].wheel[0]","root.bike[0].wheel[0]","=","root.bike[0].wheel[0]")',
                # 'binary("root.bike[0].wheel[1]=root.bike[0].wheel[0]","root.bike[0].wheel[1]","=","root.bike[0].wheel[0]")',
                # 'binary("root.bike[1].wheel[0]=root.bike[1].wheel[1]","root.bike[1].wheel[0]","=","root.bike[1].wheel[1]")',
                # 'binary("root.bike[1].wheel[1]=root.bike[1].wheel[1]","root.bike[1].wheel[1]","=","root.bike[1].wheel[1]")',
                # 'binary("root.bike[1].wheel[0]=root.bike[1].wheel[0]","root.bike[1].wheel[0]","=","root.bike[1].wheel[0]")',
                # 'binary("root.bike[1].wheel[1]=root.bike[1].wheel[0]","root.bike[1].wheel[1]","=","root.bike[1].wheel[0]")',
                'column((0,"root.bike[1]"),("root.bike[1].wheel[0]",("root.bike[1].material[0]",())),0,"root.bike[1].wheel[0]")',
                'column((0,"root.bike[1]"),("root.bike[1].wheel[1]",("root.bike[1].material[0]",())),0,"root.bike[1].wheel[1]")',
                'column((0,"root.bike[0]"),("root.bike[0].wheel[0]",("root.bike[0].material[0]",())),0,"root.bike[0].wheel[0]")',
                'column((0,"root.bike[0]"),("root.bike[0].wheel[1]",("root.bike[0].material[0]",())),0,"root.bike[0].wheel[1]")',
                'column((0,"root.bike[1]"),("root.bike[1].wheel[1]",("root.bike[1].material[0]",())),1,"root.bike[1].material[0]")',
                'column((0,"root.bike[1]"),("root.bike[1].wheel[0]",("root.bike[1].material[0]",())),1,"root.bike[1].material[0]")',
                'column((0,"root.bike[0]"),("root.bike[0].wheel[1]",("root.bike[0].material[0]",())),1,"root.bike[0].material[0]")',
                'column((0,"root.bike[0]"),("root.bike[0].wheel[0]",("root.bike[0].material[0]",())),1,"root.bike[0].material[0]")',
            }
        ),
    },
    "simple_numeric_feature": {
        "test": StableModels(
            {
                'integer("product.size")',
                'part("product")',
                'constraint(("root.size",1),"lowerbound")',
                'index("root.size[0]",0)',
                'parent("root.size[0]","root")',
                'set("root.size","root.size[0]")',
                'type("root","product")',
                'type("root.size[0]","product.size")',
                'range("product.size",1,3)',
            }
        ),
        "program": """
            coom_structure("product").
            coom_feature("product","size","num",1,1).
            coom_range("product","size",1,3).""",
    },
    "simple_arithmetic_plus": {
        "test": StableModels(
            {
                'integer("product.a")',
                'integer("product.b")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'constraint(("root.b",1),"lowerbound")',
                'constraint((0,"root.a[0]+root.b[0]<6"),"boolean")',
                'index("root.a[0]",0)',
                'index("root.b[0]",0)',
                'number("6",6)',
                'parent("root.a[0]","root")',
                'parent("root.b[0]","root")',
                'set("root.a","root.a[0]")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'type("root.b[0]","product.b")',
                'range("product.a",1,1)',
                'range("product.b",3,3)',
                'binary("root.a[0]+root.b[0]","root.a[0]","+","root.b[0]")',
                'binary("root.a[0]+root.b[0]<6","root.a[0]+root.b[0]","<","6")',
            }
        ),
    },
    "simple_arithmetic_minus": {
        "test": StableModels(
            {
                'integer("product.a")',
                'integer("product.b")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'constraint(("root.b",1),"lowerbound")',
                'constraint((0,"root.b[0]-root.a[0]>=3"),"boolean")',
                'index("root.a[0]",0)',
                'index("root.b[0]",0)',
                'number("3",3)',
                'parent("root.a[0]","root")',
                'parent("root.b[0]","root")',
                'set("root.a","root.a[0]")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'type("root.b[0]","product.b")',
                'range("product.a",1,3)',
                'range("product.b",3,4)',
                'binary("root.b[0]-root.a[0]","root.b[0]","-","root.a[0]")',
                'binary("root.b[0]-root.a[0]>=3","root.b[0]-root.a[0]",">=","3")',
            }
        ),
    },
    "simple_arithmetic_multiplication": {
        "test": StableModels(
            {
                'integer("product.a")',
                'integer("product.b")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'constraint(("root.b",1),"lowerbound")',
                'constraint((0,"root.a[0]*root.b[0]>=10"),"boolean")',
                'index("root.a[0]",0)',
                'index("root.b[0]",0)',
                'number("10",10)',
                'parent("root.a[0]","root")',
                'parent("root.b[0]","root")',
                'set("root.a","root.a[0]")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'type("root.b[0]","product.b")',
                'range("product.a",1,3)',
                'range("product.b",3,4)',
                'binary("root.a[0]*root.b[0]","root.a[0]","*","root.b[0]")',
                'binary("root.a[0]*root.b[0]>=10","root.a[0]*root.b[0]",">=","10")',
            }
        ),
    },
    "simple_arithmetic_plus_default_right": {
        "test": StableModels(
            {
                'integer("product.a")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'index("root.a[0]",0)',
                'number("2",2)',
                'parent("root.a[0]","root")',
                'set("root.a","root.a[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'range("product.a",1,3)',
                'binary("root.a[0]=2","root.a[0]","=","2")',
                'constraint((0,"root.a[0]=2"),"boolean")',
            }
        ),
    },
    "simple_arithmetic_plus_default_left": {
        "test": StableModels(
            {
                'integer("product.b")',
                'part("product")',
                'constraint(("root.b",1),"lowerbound")',
                'index("root.b[0]",0)',
                'number("2",2)',
                'parent("root.b[0]","root")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.b[0]","product.b")',
                'range("product.b",1,3)',
                'binary("root.b[0]=2","root.b[0]","=","2")',
                'constraint((0,"root.b[0]=2"),"boolean")',
            }
        ),
    },
    "simple_arithmetic_minus_default_right": {
        "test": StableModels(
            {
                'integer("product.a")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'index("root.a[0]",0)',
                'number("2",2)',
                'parent("root.a[0]","root")',
                'set("root.a","root.a[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'range("product.a",1,3)',
            }
        ),
    },
    "simple_arithmetic_minus_default_left": {
        "test": StableModels(
            {
                'integer("product.b")',
                'part("product")',
                'constraint(("root.b",1),"lowerbound")',
                'index("root.b[0]",0)',
                'number("2",2)',
                'parent("root.b[0]","root")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.b[0]","product.b")',
                'range("product.b",1,3)',
            }
        ),
    },
    "parentheses": {
        "test": StableModels(
            {
                'integer("product.a")',
                'integer("product.b")',
                'part("product")',
                'constraint(("root.a",1),"lowerbound")',
                'constraint(("root.b",1),"lowerbound")',
                'constraint((0,"root.a[0]=(root.b[0])"),"boolean")',
                'index("root.a[0]",0)',
                'index("root.b[0]",0)',
                'parent("root.a[0]","root")',
                'parent("root.b[0]","root")',
                'set("root.a","root.a[0]")',
                'set("root.b","root.b[0]")',
                'type("root","product")',
                'type("root.a[0]","product.a")',
                'type("root.b[0]","product.b")',
                'range("product.a",1,2)',
                'range("product.b",1,3)',
                'unary("(root.b[0])","()","root.b[0]")',
                'binary("root.a[0]=(root.b[0])","root.a[0]","=","(root.b[0])")',
            }
        ),
    },
    "count": {
        "test": StableModels(
            {
                'part("product")',
                'part("Bag")',
                'constraint(("root.bag",0),"lowerbound")',
                'constraint((0,"count(root.bag)<=2"),"boolean")',
                'index("root.bag[0]",0)',
                'index("root.bag[1]",1)',
                'index("root.bag[2]",2)',
                'number("2",2)',
                'parent("root.bag[0]","root")',
                'parent("root.bag[1]","root")',
                'parent("root.bag[2]","root")',
                'set("root.bag","root.bag[0]")',
                'set("root.bag","root.bag[1]")',
                'set("root.bag","root.bag[2]")',
                'type("root","product")',
                'type("root.bag[0]","Bag")',
                'type("root.bag[1]","Bag")',
                'type("root.bag[2]","Bag")',
                'function("count(root.bag)","count","root.bag")',
                'binary("count(root.bag)<=2","count(root.bag)","<=","2")',
            }
        ),
    },
    "sum": {
        "test": StableModels(
            {
                'integer("product.x")',
                'part("product")',
                'constraint(("root.x",0),"lowerbound")',
                'constraint((0,"sum(root.x)<=10"),"boolean")',
                'index("root.x[0]",0)',
                'index("root.x[1]",1)',
                'index("root.x[2]",2)',
                'number("10",10)',
                'parent("root.x[0]","root")',
                'parent("root.x[1]","root")',
                'parent("root.x[2]","root")',
                'set("root.x","root.x[0]")',
                'set("root.x","root.x[1]")',
                'set("root.x","root.x[2]")',
                'type("root","product")',
                'type("root.x[0]","product.x")',
                'type("root.x[1]","product.x")',
                'type("root.x[2]","product.x")',
                'function("sum(root.x)","sum","root.x")',
                'range("product.x",0,10)',
                'binary("sum(root.x)<=10","sum(root.x)","<=","10")',
            }
        ),
    },
    "simple_default": {
        "test": StableModels(
            {
                'discrete("Color")',
                'domain("Color","Red")',
                'domain("Color","White")',
                'domain("Color","Black")',
                'type("root","product")',
                'type("root.color[0]","Color")',
                'index("root.color[0]",0)',
                'parent("root.color[0]","root")',
                'constraint(("root.color",1),"lowerbound")',
                'set("root.color","root.color[0]")',
                'part("product")',
                'constant("White")',
                'default("root.color[0]","White")',
            }
        ),
    },
    "minimize": {
        "test": StableModels(
            {
                'integer("product.totalWeight")',
                'range("product.totalWeight",1,10)',
                'type("root","product")',
                'type("root.totalWeight[0]","product.totalWeight")',
                'index("root.totalWeight[0]",0)',
                'parent("root.totalWeight[0]","root")',
                'constraint(("root.totalWeight",1),"lowerbound")',
                'set("root.totalWeight","root.totalWeight[0]")',
                'part("product")',
                'minimize("root.totalWeight[0]",0)',
            }
        ),
    },
    "maximize": {
        "test": StableModels(
            {
                'integer("product.totalOutput")',
                'range("product.totalOutput",1,10)',
                'type("root","product")',
                'type("root.totalOutput[0]","product.totalOutput")',
                'index("root.totalOutput[0]",0)',
                'parent("root.totalOutput[0]","root")',
                'constraint(("root.totalOutput",1),"lowerbound")',
                'set("root.totalOutput","root.totalOutput[0]")',
                'part("product")',
                'maximize("root.totalOutput[0]",1)',
            }
        ),
    },
    "minimize_non_root_path": {
        "test": StableModels(
            {
                'integer("Bag.weight")',
                'range("Bag.weight",0,10)',
                'type("root","product")',
                'type("root.bags[0]","Bag")',
                'type("root.bags[0].weight[0]","Bag.weight")',
                'index("root.bags[0]",0)',
                'index("root.bags[0].weight[0]",0)',
                'parent("root.bags[0]","root")',
                'parent("root.bags[0].weight[0]","root.bags[0]")',
                'constraint(("root.bags",1),"lowerbound")',
                'constraint(("root.bags[0].weight",1),"lowerbound")',
                'set("root.bags","root.bags[0]")',
                'set("root.bags[0].weight","root.bags[0].weight[0]")',
                'part("product")',
                'part("Bag")',
                'minimize("root.bags[0].weight[0]",1)',
            }
        ),
    },
    "maximize_non_root_path": {
        "test": StableModels(
            {
                'integer("Bag.volume")',
                'range("Bag.volume",0,10)',
                'type("root","product")',
                'type("root.bags[0]","Bag")',
                'type("root.bags[0].volume[0]","Bag.volume")',
                'index("root.bags[0]",0)',
                'index("root.bags[0].volume[0]",0)',
                'parent("root.bags[0]","root")',
                'parent("root.bags[0].volume[0]","root.bags[0]")',
                'constraint(("root.bags",1),"lowerbound")',
                'constraint(("root.bags[0].volume",1),"lowerbound")',
                'set("root.bags","root.bags[0]")',
                'set("root.bags[0].volume","root.bags[0].volume[0]")',
                'part("product")',
                'part("Bag")',
                'minimize("root.bags[0].volume[0]",1)',
            }
        ),
    },
    "minimize_function": {
        "test": StableModels(
            {
                'integer("Bag.volume")',
                'range("Bag.volume",0,10)',
                'type("root","product")',
                'type("root.bags[0]","Bag")',
                'type("root.bags[1]","Bag")',
                'type("root.bags[1].volume[0]","Bag.volume")',
                'type("root.bags[0].volume[0]","Bag.volume")',
                'index("root.bags[0]",0)',
                'index("root.bags[1]",1)',
                'index("root.bags[1].volume[0]",0)',
                'index("root.bags[0].volume[0]",0)',
                'parent("root.bags[0]","root")',
                'parent("root.bags[1]","root")',
                'parent("root.bags[1].volume[0]","root.bags[1]")',
                'parent("root.bags[0].volume[0]","root.bags[0]")',
                'constraint(("root.bags",0),"lowerbound")',
                'constraint(("root.bags[0].volume",1),"lowerbound")',
                'constraint(("root.bags[1].volume",1),"lowerbound")',
                'function("count(root.bags)","count","root.bags")',
                'set("root.bags","root.bags[0]")',
                'set("root.bags","root.bags[1]")',
                'set("root.bags[0].volume","root.bags[0].volume[0]")',
                'set("root.bags[1].volume","root.bags[1].volume[0]")',
                'part("product")',
                'part("Bag")',
                'minimize("count(root.bags)",0)',
            }
        ),
    },
    "maximize_function": {
        "test": StableModels(
            {
                'integer("Bag.volume")',
                'range("Bag.volume",0,10)',
                'type("root","product")',
                'type("root.bags[0]","Bag")',
                'type("root.bags[1]","Bag")',
                'type("root.bags[1].volume[0]","Bag.volume")',
                'type("root.bags[0].volume[0]","Bag.volume")',
                'index("root.bags[0]",0)',
                'index("root.bags[1]",1)',
                'index("root.bags[1].volume[0]",0)',
                'index("root.bags[0].volume[0]",0)',
                'parent("root.bags[0]","root")',
                'parent("root.bags[1]","root")',
                'parent("root.bags[1].volume[0]","root.bags[1]")',
                'parent("root.bags[0].volume[0]","root.bags[0]")',
                'constraint(("root.bags",0),"lowerbound")',
                'constraint(("root.bags[0].volume",1),"lowerbound")',
                'constraint(("root.bags[1].volume",1),"lowerbound")',
                'function("sum(root.bags.volume)","sum","root.bags.volume")',
                'set("root.bags","root.bags[0]")',
                'set("root.bags","root.bags[1]")',
                'set("root.bags[0].volume","root.bags[0].volume[0]")',
                'set("root.bags[1].volume","root.bags[1].volume[0]")',
                'set("root.bags.volume","root.bags[1].volume[0]")',
                'set("root.bags.volume","root.bags[0].volume[0]")',
                'part("product")',
                'part("Bag")',
                'maximize("sum(root.bags.volume)",0)',
            }
        ),
    },
    "set_constant": {
        "test": StableModels({'user_value("root.color[0]","Yellow")'}),
        "program": 'coom_user_value("root.color[0]","Yellow").',
    },
    "set_number": {
        "test": StableModels({'user_value("root.size[0]",5)'}),
        "program": 'coom_user_value("root.size[0]",5).',
    },
    "add": {
        "test": StableModels({'user_include("root.bag[0]")'}),
        "program": 'coom_user_include("root.bag[0]").',
    },
    "unbounded_singleshot_zero_lb_zero_max": {
        "test": StableModels(get_model_from_file("unbounded_singleshot_zero_lb_zero_max.lp")),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_singleshot_zero_lb_one_max": {
        "test": StableModels(get_model_from_file("unbounded_singleshot_zero_lb_one_max.lp")),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_singleshot_two_lb_zero_max": {
        "test": StableModels(get_model_from_file("unbounded_singleshot_two_lb_zero_max.lp")),
        "files": ["unbounded_two_lb.lp"],
    },
    "unbounded_singleshot_two_lb_one_max": {
        "test": StableModels(get_model_from_file("unbounded_singleshot_two_lb_one_max.lp")),
        "files": ["unbounded_two_lb.lp"],
    },
    "unbounded_singleshot_optimize": {
        "test": StableModels(get_model_from_file("unbounded_singleshot_optimize.lp")),
        "files": ["unbounded_optimize.lp"],
    },
    "unbounded_multishot_zero_lb_zero_max_superset": {
        "test": Supersets(get_model_from_file("unbounded_singleshot_zero_lb_zero_max.lp")),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_multishot_zero_lb_one_max_superset": {
        "test": Supersets(get_model_from_file("unbounded_singleshot_zero_lb_one_max.lp")),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_multishot_two_lb_zero_max_superset": {
        "test": Supersets(get_model_from_file("unbounded_singleshot_two_lb_zero_max.lp")),
        "files": ["unbounded_two_lb.lp"],
    },
    "unbounded_multishot_two_lb_one_max_superset": {
        "test": Supersets(get_model_from_file("unbounded_singleshot_two_lb_one_max.lp")),
        "files": ["unbounded_two_lb.lp"],
    },
    "unbounded_multishot_optimize_superset": {
        "test": Supersets(get_model_from_file("unbounded_singleshot_optimize.lp")),
        "files": ["unbounded_optimize.lp"],
    },
    "unbounded_multishot_optimize": {
        "test": StableModels(
            get_model_from_file("unbounded_singleshot_optimize.lp")
            | {
                'inc_set("root.bags")',
                'incremental("function","count(root.bags)",("count(root.bags)","count","root.bags"))',
                'incremental("minimize","count(root.bags)",("count(root.bags)",0))',
            }
        ),
        "files": ["unbounded_optimize.lp"],
    },
    "unbounded_multishot_zero_lb_zero_max": {
        "test": StableModels(
            get_model_from_file("unbounded_singleshot_zero_lb_zero_max.lp")
            | {
                'inc_set("root.bags.size.volume")',
                'inc_set("root.bags.pockets")',
                'incremental("function","sum(root.bags.size.volume)",("sum(root.bags.size.volume)","sum","root.bags.size.volume"))',
                'incremental("function","count(root.bags.pockets)",("count(root.bags.pockets)","count","root.bags.pockets"))',
                'incremental("binary","root.totalVolume[0]=sum(root.bags.size.volume)",("root.totalVolume[0]=sum(root.bags.size.volume)","root.totalVolume[0]","=","sum(root.bags.size.volume)"))',
                'incremental("binary","5<count(root.bags.pockets)",("5<count(root.bags.pockets)","5","<","count(root.bags.pockets)"))',
                'incremental("constraint","root.totalVolume[0]=sum(root.bags.size.volume)",((0,"root.totalVolume[0]=sum(root.bags.size.volume)"),"boolean"))',
                'incremental("constraint","5<count(root.bags.pockets)",((4,"5<count(root.bags.pockets)"),"boolean"))',
            }
        ),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_multishot_two_lb_zero_max": {
        "test": StableModels(
            get_model_from_file("unbounded_singleshot_two_lb_zero_max.lp")
            | {
                'inc_set("root.bags.size.volume")',
                'inc_set("root.bags.pockets")',
                'inc_set("root.bags[0].pockets")',
                'inc_set("root.bags[1].pockets")',
                'incremental("function","sum(root.bags.size.volume)",("sum(root.bags.size.volume)","sum","root.bags.size.volume"))',
                'incremental("function","count(root.bags.pockets)",("count(root.bags.pockets)","count","root.bags.pockets"))',
                'incremental("function","count(root.bags[0].pockets)",("count(root.bags[0].pockets)","count","root.bags[0].pockets"))',
                'incremental("function","count(root.bags[1].pockets)",("count(root.bags[1].pockets)","count","root.bags[1].pockets"))',
                'incremental("constraint","root.bags[0]",((7,"root.bags[0]"),"table"))',
                'incremental("constraint","root.bags[1]",((7,"root.bags[1]"),"table"))',
                'incremental("binary","root.totalVolume[0]=sum(root.bags.size.volume)",("root.totalVolume[0]=sum(root.bags.size.volume)","root.totalVolume[0]","=","sum(root.bags.size.volume)"))',
                'incremental("binary","5<count(root.bags.pockets)",("5<count(root.bags.pockets)","5","<","count(root.bags.pockets)"))',
                'incremental("binary","2<=count(root.bags[0].pockets)",("2<=count(root.bags[0].pockets)","2","<=","count(root.bags[0].pockets)"))',
                'incremental("binary","2<=count(root.bags[1].pockets)",("2<=count(root.bags[1].pockets)","2","<=","count(root.bags[1].pockets)"))',
                'incremental("constraint","root.totalVolume[0]=sum(root.bags.size.volume)",((0,"root.totalVolume[0]=sum(root.bags.size.volume)"),"boolean"))',
                'incremental("constraint","5<count(root.bags.pockets)",((4,"5<count(root.bags.pockets)"),"boolean"))',
                'incremental("binary","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",("!count(root.bags[0])=1||2<=count(root.bags[0].pockets)","!count(root.bags[0])=1","||","2<=count(root.bags[0].pockets)"))',
                'incremental("binary","!count(root.bags[1])=1||2<=count(root.bags[1].pockets)",("!count(root.bags[1])=1||2<=count(root.bags[1].pockets)","!count(root.bags[1])=1","||","2<=count(root.bags[1].pockets)"))',
                'incremental("constraint","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",((5,"!count(root.bags[0])=1||2<=count(root.bags[0].pockets)"),"boolean"))',
                'incremental("constraint","!count(root.bags[1])=1||2<=count(root.bags[1].pockets)",((5,"!count(root.bags[1])=1||2<=count(root.bags[1].pockets)"),"boolean"))',
            }
        ),
        "files": ["unbounded_two_lb.lp"],
    },
    "unbounded_multishot_zero_lb_one_max": {
        "test": StableModels(
            get_model_from_file("unbounded_singleshot_zero_lb_one_max.lp")
            | {
                'inc_set("root.bags.size.volume")',
                'inc_set("root.bags.pockets")',
                'inc_set("root.bags[0].pockets")',
                'incremental("function","sum(root.bags.size.volume)",("sum(root.bags.size.volume)","sum","root.bags.size.volume"))',
                'incremental("function","count(root.bags.pockets)",("count(root.bags.pockets)","count","root.bags.pockets"))',
                'incremental("function","count(root.bags[0].pockets)",("count(root.bags[0].pockets)","count","root.bags[0].pockets"))',
                'incremental("constraint","root.bags[0]",((7,"root.bags[0]"),"table"))',
                'incremental("binary","root.totalVolume[0]=sum(root.bags.size.volume)",("root.totalVolume[0]=sum(root.bags.size.volume)","root.totalVolume[0]","=","sum(root.bags.size.volume)"))',
                'incremental("binary","5<count(root.bags.pockets)",("5<count(root.bags.pockets)","5","<","count(root.bags.pockets)"))',
                'incremental("binary","2<=count(root.bags[0].pockets)",("2<=count(root.bags[0].pockets)","2","<=","count(root.bags[0].pockets)"))',
                'incremental("constraint","root.totalVolume[0]=sum(root.bags.size.volume)",((0,"root.totalVolume[0]=sum(root.bags.size.volume)"),"boolean"))',
                'incremental("constraint","5<count(root.bags.pockets)",((4,"5<count(root.bags.pockets)"),"boolean"))',
                'incremental("binary","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",("!count(root.bags[0])=1||2<=count(root.bags[0].pockets)","!count(root.bags[0])=1","||","2<=count(root.bags[0].pockets)"))',
                'incremental("constraint","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",((5,"!count(root.bags[0])=1||2<=count(root.bags[0].pockets)"),"boolean"))',
            }
        ),
        "files": ["unbounded_zero_lb.lp"],
    },
    "unbounded_multishot_two_lb_one_max": {
        "test": StableModels(
            get_model_from_file("unbounded_singleshot_two_lb_one_max.lp")
            | {
                'inc_set("root.bags.size.volume")',
                'inc_set("root.bags.pockets")',
                'inc_set("root.bags[0].pockets")',
                'inc_set("root.bags[1].pockets")',
                'inc_set("root.bags[2].pockets")',
                'incremental("function","sum(root.bags.size.volume)",("sum(root.bags.size.volume)","sum","root.bags.size.volume"))',
                'incremental("function","count(root.bags.pockets)",("count(root.bags.pockets)","count","root.bags.pockets"))',
                'incremental("function","count(root.bags[0].pockets)",("count(root.bags[0].pockets)","count","root.bags[0].pockets"))',
                'incremental("function","count(root.bags[1].pockets)",("count(root.bags[1].pockets)","count","root.bags[1].pockets"))',
                'incremental("function","count(root.bags[2].pockets)",("count(root.bags[2].pockets)","count","root.bags[2].pockets"))',
                'incremental("constraint","root.bags[0]",((7,"root.bags[0]"),"table"))',
                'incremental("constraint","root.bags[1]",((7,"root.bags[1]"),"table"))',
                'incremental("constraint","root.bags[2]",((7,"root.bags[2]"),"table"))',
                'incremental("binary","root.totalVolume[0]=sum(root.bags.size.volume)",("root.totalVolume[0]=sum(root.bags.size.volume)","root.totalVolume[0]","=","sum(root.bags.size.volume)"))',
                'incremental("binary","5<count(root.bags.pockets)",("5<count(root.bags.pockets)","5","<","count(root.bags.pockets)"))',
                'incremental("binary","2<=count(root.bags[0].pockets)",("2<=count(root.bags[0].pockets)","2","<=","count(root.bags[0].pockets)"))',
                'incremental("binary","2<=count(root.bags[1].pockets)",("2<=count(root.bags[1].pockets)","2","<=","count(root.bags[1].pockets)"))',
                'incremental("binary","2<=count(root.bags[2].pockets)",("2<=count(root.bags[2].pockets)","2","<=","count(root.bags[2].pockets)"))',
                'incremental("constraint","root.totalVolume[0]=sum(root.bags.size.volume)",((0,"root.totalVolume[0]=sum(root.bags.size.volume)"),"boolean"))',
                'incremental("constraint","5<count(root.bags.pockets)",((4,"5<count(root.bags.pockets)"),"boolean"))',
                'incremental("binary","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",("!count(root.bags[0])=1||2<=count(root.bags[0].pockets)","!count(root.bags[0])=1","||","2<=count(root.bags[0].pockets)"))',
                'incremental("binary","!count(root.bags[1])=1||2<=count(root.bags[1].pockets)",("!count(root.bags[1])=1||2<=count(root.bags[1].pockets)","!count(root.bags[1])=1","||","2<=count(root.bags[1].pockets)"))',
                'incremental("binary","!count(root.bags[2])=1||2<=count(root.bags[2].pockets)",("!count(root.bags[2])=1||2<=count(root.bags[2].pockets)","!count(root.bags[2])=1","||","2<=count(root.bags[2].pockets)"))',
                'incremental("constraint","!count(root.bags[0])=1||2<=count(root.bags[0].pockets)",((5,"!count(root.bags[0])=1||2<=count(root.bags[0].pockets)"),"boolean"))',
                'incremental("constraint","!count(root.bags[1])=1||2<=count(root.bags[1].pockets)",((5,"!count(root.bags[1])=1||2<=count(root.bags[1].pockets)"),"boolean"))',
                'incremental("constraint","!count(root.bags[2])=1||2<=count(root.bags[2].pockets)",((5,"!count(root.bags[2])=1||2<=count(root.bags[2].pockets)"),"boolean"))',
            }
        ),
        "files": ["unbounded_two_lb.lp"],
    },
}
