Browse Source

Fix input tests

Ensure signed values are respected.
master
TheoryOfNekomata 1 year ago
parent
commit
bdfd7c1d74
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      __tests__/src/packages/game/input.test.c

+ 24
- 0
__tests__/src/packages/game/input.test.c View File

@@ -99,6 +99,9 @@ spec("input") {

it("handles positive motion") {
e.jaxis.value = GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value < 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -111,6 +114,9 @@ spec("input") {

it("handles negative motion") {
e.jaxis.value = -GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value > 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -141,6 +147,9 @@ spec("input") {

it("handles positive motion") {
e.jaxis.value = GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value < 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -153,6 +162,9 @@ spec("input") {

it("handles negative motion") {
e.jaxis.value = -GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value > 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -183,6 +195,9 @@ spec("input") {

it("handles positive motion") {
e.jaxis.value = GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value < 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -195,6 +210,9 @@ spec("input") {

it("handles negative motion") {
e.jaxis.value = -GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value > 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -225,6 +243,9 @@ spec("input") {

it("handles positive motion") {
e.jaxis.value = GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value < 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);
@@ -237,6 +258,9 @@ spec("input") {

it("handles negative motion") {
e.jaxis.value = -GenerateAxisValueOutsideThreshold(state[p].config.axis_threshold);
if (e.jaxis.value > 0) {
e.jaxis.value = -e.jaxis.value;
}
action[p] = 0;

printf("(axis value: %d) ", e.jaxis.value);


Loading…
Cancel
Save