import pytest
from aiforge.core.registry import register, get_operator, list_operators, registry
from aiforge.core.context import BaseOperator
from aiforge.core.pipeline import Pipeline
from aiforge.core.executor import execute

# Mock Operator for testing
@register("dummy_op")
class DummyOp(BaseOperator):
    def run(self, data, multiplier=2):
        return data * multiplier

def test_registry():
    assert "dummy_op" in list_operators()
    op = get_operator("dummy_op")
    assert isinstance(op, DummyOp)
    
def test_pipeline_execution():
    pipe = Pipeline()
    pipe.add("dummy_op", multiplier=3)
    pipe.add("dummy_op", multiplier=2)
    
    result = pipe.run(5)
    # 5 * 3 = 15 -> 15 * 2 = 30
    assert result == 30
    
def test_executor_directly():
    steps = [
        ("dummy_op", {"multiplier": 10})
    ]
    result = execute(steps, 2)
    assert result == 20
