# Path: pygesture/experiment.py
# class TACSession(object):
#     def __init__(self, gestures, simul=1, rep=1, timeout=0, dist=50, tol=10,
#                  dwell=0):
#     def reshuffle(self):
# def _gesture_combinations(gestures, k=1):
# def _shuffle(x):
# def generate_trials(trial_set, n_repeat=1):
# 
# Path: pygesture/util.py
# class Gesture(object):
# class Sensor(object):
#     def __init__(self, label, name, description, dof=None, action=None):
#     def __init__(self, channel, name, description=""):


from pygesture import experiment
from pygesture import util


class TestTACSession(object):

    def test_simple(self):
        gestures = [
            util.Gesture(0, "0a", "", dof=0),
            util.Gesture(1, "0b", "", dof=0),
            util.Gesture(2, "1a", "", dof=1),
            util.Gesture(3, "1b", "", dof=1),
            util.Gesture(4, "2a", "", dof=2),
            util.Gesture(5, "2b", "", dof=2)
        ]

        session = experiment.TACSession(gestures, simul=1)
        a = sorted(gestures, key=lambda g: g.label)
        b = sorted([t[0] for t in session.targets], key=lambda g: g.label)
        assert a == b

        session = experiment.TACSession(gestures, simul=2)
        assert len(session.targets) == 12

        session = experiment.TACSession(gestures, simul=3)
        assert len(session.targets) == 8


# Path: pygesture/experiment.py
# class TACSession(object):
#     def __init__(self, gestures, simul=1, rep=1, timeout=0, dist=50, tol=10,
#                  dwell=0):
#     def reshuffle(self):
# def _gesture_combinations(gestures, k=1):
# def _shuffle(x):
# def generate_trials(trial_set, n_repeat=1):
# 
# Path: pygesture/util.py
# class Gesture(object):
# class Sensor(object):
#     def __init__(self, label, name, description, dof=None, action=None):
#     def __init__(self, channel, name, description=""):


# Path: pygesture/tests/test_experiment.py
from pygesture import experiment
from pygesture import util



class TestTACSession(object):

    def test_simple(self):
        gestures = [
            util.Gesture(0, "0a", "", dof=0),
            util.Gesture(1, "0b", "", dof=0),
            util.Gesture(2, "1a", "", dof=1),
            util.Gesture(3, "1b", "", dof=1),
            util.Gesture(4, "2a", "", dof=2),
            util.Gesture(5, "2b", "", dof=2)
        ]

        session = experiment.TACSession(gestures, simul=1)
        a = sorted(gestures, key=lambda g: g.label)
        b = sorted([t[0] for t in session.targets], key=lambda g: g.label)
        assert a == b

        session = experiment.TACSession(gestures, simul=2)
        assert len(session.targets) == 12

        session = experiment.TACSession(gestures, simul=3)
        assert len(session.targets) == 8


        session = experiment.TACSession(gestures, simul=4)