2024-02-17 18:37:40 +01:00
|
|
|
|
|
|
|
import { test, expect } from '@playwright/test';
|
2024-03-22 08:00:24 +01:00
|
|
|
import {ScriptAccountCondition} from "../../../../src/app/game-model/gamesystems/conditions/ScriptAccountCondition";
|
|
|
|
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
|
2024-02-17 18:37:40 +01:00
|
|
|
import exp = require("node:constants");
|
|
|
|
import {ConditionTrainer} from "./ConditionTrainer";
|
|
|
|
import {Conditional} from "@angular/compiler";
|
|
|
|
test.describe('Test Contradicting Conditions', () => {
|
|
|
|
|
|
|
|
test("Test contradicting conditions", async () => {
|
|
|
|
const condition = ConditionTrainer.withSimpleCondition();
|
|
|
|
|
|
|
|
let contradictingCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.maxValue + 10, condition.maxValue+200);
|
|
|
|
expect(condition.isContradicting(contradictingCondition)).toBeTruthy();
|
|
|
|
|
|
|
|
contradictingCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.minValue-100, condition.minValue-50);
|
|
|
|
expect(condition.isContradicting(contradictingCondition)).toBeTruthy();
|
|
|
|
})
|
|
|
|
|
|
|
|
test("Test intersecting conditions", async () => {
|
|
|
|
const condition = ConditionTrainer.withSimpleCondition();
|
|
|
|
let otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.minValue-1, condition.minValue+1);
|
|
|
|
expect(condition.isContradicting(otherCondition)).toBeFalsy();
|
|
|
|
|
|
|
|
otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.maxValue-1, condition.maxValue+1);
|
|
|
|
expect(condition.isContradicting(otherCondition)).toBeFalsy();
|
|
|
|
|
|
|
|
otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.minValue-1, condition.maxValue+1);
|
|
|
|
expect(condition.isContradicting(otherCondition)).toBeFalsy();
|
|
|
|
|
|
|
|
expect(condition.isContradicting(condition)).toBeFalsy();
|
|
|
|
})
|
|
|
|
|
|
|
|
test("Test contradicting conditions with different ScriptAccount", async () => {
|
|
|
|
const condition = ConditionTrainer.withSimpleCondition();
|
|
|
|
const otherCondition = ScriptAccountCondition.constructScriptAccountCondition(
|
|
|
|
new ScriptAccount("Another test", ""), condition.minValue-20, condition.minValue-10);
|
|
|
|
|
|
|
|
expect(condition.isContradicting(otherCondition)).toBeFalsy();
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
});
|