BareGit
const test = require("node:test");
const assert = require("node:assert/strict");
const logic = require("../static/game_field_form.js");

test("choice movement stays within the ordered list", function()
{
    assert.equal(logic.choiceMoveIndex(1, -1, 3), 0);
    assert.equal(logic.choiceMoveIndex(1, 1, 3), 2);
    assert.equal(logic.choiceMoveIndex(0, -1, 3), 0);
    assert.equal(logic.choiceMoveIndex(2, 1, 3), 2);
    assert.equal(logic.choiceMoveIndex(-1, 1, 3), -1);
    assert.equal(logic.choiceMoveIndex(0, 1, 0), 0);
});