slp-enforcer
Version:
Finds violations of the Melee Controller Ruleset by inspecting SLP files
45 lines (44 loc) • 2.4 kB
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const globals_1 = require("@jest/globals");
const index_1 = require("../index");
const goomwave_1 = require("../goomwave");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
globals_1.test('Test isGoomwave (negative)', () => {
for (let i = 1; i <= 7; i++) {
let data = fs.readFileSync(path.join(__dirname, '../../test_data/legal/digital/potion_p3/potion_' + i + '.slp'), null);
let game = new index_1.SlippiGame(index_1.toArrayBuffer(data));
globals_1.expect(game).not.toBeNull();
let gameCoords = index_1.getCoordListFromGame(game, 2, true);
globals_1.expect(index_1.isGoomwave(game, 2, gameCoords).result).toEqual(false);
}
});
globals_1.test('Test isGoomwave A (positive)', async () => {
let data = fs.readFileSync(path.join(__dirname, '../../test_data/nonlegal/analog/goomwave_uptilt_p1.slp'), null);
let game = new index_1.SlippiGame(index_1.toArrayBuffer(data));
globals_1.expect(game).not.toBeNull();
let coords = index_1.getCoordListFromGame(game, 0, true);
globals_1.expect(goomwave_1.hasGoomwaveClamping(coords)).toEqual(true);
});
globals_1.test('Test isGoomwave B (positive)', async () => {
let data = fs.readFileSync(path.join(__dirname, '../../test_data/nonlegal/analog/goomwave/Game_20250216T194607.slp'), null);
let game = new index_1.SlippiGame(index_1.toArrayBuffer(data));
globals_1.expect(game).not.toBeNull();
let coords = index_1.getCoordListFromGame(game, 1, true);
globals_1.expect(index_1.isGoomwave(game, 1, coords).result).toEqual(true);
});
globals_1.test('Test isGoomwave C (positive)', async () => {
let data = fs.readFileSync(path.join(__dirname, '../../test_data/nonlegal/analog/goomwave/Game_20250216T194746.slp'), null);
let game = new index_1.SlippiGame(index_1.toArrayBuffer(data));
globals_1.expect(game).not.toBeNull();
let coords = index_1.getCoordListFromGame(game, 1, true);
globals_1.expect(index_1.isGoomwave(game, 1, coords).result).toEqual(true);
});