25 lines
854 B
Python
25 lines
854 B
Python
import sys, os
|
|
SRC_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
if SRC_PATH not in sys.path:
|
|
sys.path.insert(0, SRC_PATH)
|
|
|
|
try:
|
|
from edgemarketsignal.core import DeltaVectorClock, DeltaSync
|
|
except Exception:
|
|
from edgemarketsignal.core import DeltaVectorClock, DeltaSync
|
|
|
|
|
|
def test_delta_sync_reconcile_basic():
|
|
local = DeltaVectorClock({"A": 1, "B": 1})
|
|
remote = DeltaVectorClock({"A": 1, "B": 0})
|
|
|
|
local_signals = {"A": {"signal": "L_A"}, "B": {"signal": "L_B"}}
|
|
remote_signals = {"A": {"signal": "R_A"}, "B": {"signal": "R_B"}}
|
|
|
|
result = DeltaSync.reconcile(local, remote, local_signals, remote_signals)
|
|
|
|
# For venue A: 1 vs 1 -> prefer local (tie -> local)
|
|
# For venue B: 1 vs 0 -> prefer local
|
|
assert result["A"]["signal"] == "L_A"
|
|
assert result["B"]["signal"] == "L_B"
|