Ver a proveniência

Fix input tests

Ensure signed values are respected.
master
ascendente
cometimento
bdfd7c1d74
1 ficheiros alterados com 24 adições e 0 eliminações
  1. +24
    -0
      __tests__/src/packages/game/input.test.c

+ 24
- 0
__tests__/src/packages/game/input.test.c Ver ficheiro

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


Carregando…
Cancelar
Guardar