VERSION 1

KEYSWITCH LSHIFT    0 0
KEYSWITCH RSHIFT    0 1
KEYSWITCH RGUI      0 2
KEYSWITCH A         1 0
KEYSWITCH B         1 1

# ==============================================================================
NAME SpaceCadet tap

RUN 5 ms

PRESS LSHIFT
RUN 5 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_X # Report should contain `X` (0x1B)
EXPECT keyboard-report empty # Report should be empty
RUN 5 ms

# ==============================================================================
NAME SpaceCadet hold

RUN 5 ms

PRESS LSHIFT
RUN 1 cycle

RUN 10 ms
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)

RUN 5 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

# ==============================================================================
NAME SpaceCadet hold with global timeout

RUN 5 ms

PRESS RSHIFT
RUN 1 cycle

RUN 20 ms
EXPECT keyboard-report Key_RightShift # Report should contain `shift` (0xE5)

RUN 5 ms
RELEASE RSHIFT
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

# ==============================================================================
NAME SpaceCadet interrupt

RUN 5 ms
PRESS LSHIFT
RUN 1 cycle

RUN 3 ms
PRESS A
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
EXPECT keyboard-report Key_LeftShift Key_A # Report should add `A` (0x04, 0xE1)

RUN 3 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_A # Report should contain only `A` (0x04)

RUN 3 ms
RELEASE A
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

# ==============================================================================
NAME SpaceCadet interrupt SpaceCadet with tap

RUN 5 ms
PRESS LSHIFT
RUN 1 cycle

RUN 3 ms
PRESS RSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)

RUN 3 ms
RELEASE RSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift Key_Y # Report should add `Y` (0x1C)
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)

RUN 3 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

# ==============================================================================
NAME SpaceCadet interrupt SpaceCadet with hold

RUN 5 ms
PRESS LSHIFT
RUN 1 cycle

RUN 3 ms
PRESS RSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)

RUN 20 ms
EXPECT keyboard-report Key_LeftShift Key_RightShift # Report should contain both `shift` keycodes (0xE1, 0xE5)

RUN 5 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_RightShift # Report should contain `shift` (0xE5)

RUN 3 ms
RELEASE RSHIFT
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

# ==============================================================================
NAME SpaceCadet interrupt with modifier

RUN 5 ms
PRESS LSHIFT
RUN 1 cycle

RUN 3 ms
PRESS RGUI
RUN 1 cycle
EXPECT keyboard-report Key_LeftShift # report: { e1 }
EXPECT keyboard-report Key_LeftShift Key_RightGui # report: { e1 e7 }

RUN 5 ms
RELEASE LSHIFT
RUN 1 cycle
EXPECT keyboard-report Key_RightGui # report: { e7 }

RUN 3 ms
RELEASE RGUI
RUN 1 cycle
EXPECT keyboard-report empty # Report should be empty

RUN 5 ms