Selaa lähdekoodia

Fix input tests

Ensure signed values are respected.
master
TheoryOfNekomata 1 vuosi sitten
vanhempi
commit
bdfd7c1d74
1 muutettua tiedostoa jossa 24 lisäystä ja 0 poistoa
  1. +24
    -0
      __tests__/src/packages/game/input.test.c

+ 24
- 0
__tests__/src/packages/game/input.test.c Näytä tiedosto

@@ -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);


Ladataan…
Peruuta
Tallenna