Add tests confirming low-input conversion values
This commit is contained in:
parent
7750a3368d
commit
8811996f64
1 changed files with 32 additions and 0 deletions
|
@ -47,6 +47,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.currentGain)).compare_tolerance(100);
|
expect(unref(conversion.currentGain)).compare_tolerance(100);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.currentGain)).compare_tolerance(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates actualGain correctly", () => {
|
describe("Calculates actualGain correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -69,6 +73,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.actualGain)).compare_tolerance(100);
|
expect(unref(conversion.actualGain)).compare_tolerance(100);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.actualGain)).compare_tolerance(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates currentAt correctly", () => {
|
describe("Calculates currentAt correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -95,6 +103,10 @@ describe("Creating conversion", () => {
|
||||||
Decimal.pow(100, 2).times(10)
|
Decimal.pow(100, 2).times(10)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.currentAt)).compare_tolerance(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates nextAt correctly", () => {
|
describe("Calculates nextAt correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -117,6 +129,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.pow(101, 2).times(10));
|
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.pow(101, 2).times(10));
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.dTen);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test("Converts correctly", () => {
|
test("Converts correctly", () => {
|
||||||
const conversion = createCumulativeConversion(() => ({
|
const conversion = createCumulativeConversion(() => ({
|
||||||
|
@ -193,6 +209,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.currentGain)).compare_tolerance(100);
|
expect(unref(conversion.currentGain)).compare_tolerance(100);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.currentGain)).compare_tolerance(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates actualGain correctly", () => {
|
describe("Calculates actualGain correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -216,6 +236,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.actualGain)).compare_tolerance(99);
|
expect(unref(conversion.actualGain)).compare_tolerance(99);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.actualGain)).compare_tolerance(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates currentAt correctly", () => {
|
describe("Calculates currentAt correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -243,6 +267,10 @@ describe("Creating conversion", () => {
|
||||||
Decimal.pow(100, 2).times(10)
|
Decimal.pow(100, 2).times(10)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.currentAt)).compare_tolerance(Decimal.pow(1, 2).times(10));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("Calculates nextAt correctly", () => {
|
describe("Calculates nextAt correctly", () => {
|
||||||
let conversion: GenericConversion;
|
let conversion: GenericConversion;
|
||||||
|
@ -266,6 +294,10 @@ describe("Creating conversion", () => {
|
||||||
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
baseResource.value = Decimal.pow(100, 2).times(10).add(1);
|
||||||
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.pow(101, 2).times(10));
|
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.pow(101, 2).times(10));
|
||||||
});
|
});
|
||||||
|
test("Zero", () => {
|
||||||
|
baseResource.value = Decimal.dZero;
|
||||||
|
expect(unref(conversion.nextAt)).compare_tolerance(Decimal.pow(2, 2).times(10));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test("Converts correctly", () => {
|
test("Converts correctly", () => {
|
||||||
const conversion = createIndependentConversion(() => ({
|
const conversion = createIndependentConversion(() => ({
|
||||||
|
|
Loading…
Reference in a new issue