44 lines
2.2 KiB
TypeScript
44 lines
2.2 KiB
TypeScript
|
|
import { test, expect } from '@playwright/test';
|
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
|
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();
|
|
})
|
|
|
|
|
|
});
|