"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Integer_1 = require("@wireio/sdk-core/chain/Integer");
describe("Integer", () => {
    describe("UInt64", () => {
        test("from(0) creates zero value", () => {
            const val = Integer_1.UInt64.from(0);
            expect(val.toNumber()).toBe(0);
        });
        test("from(100).toNumber() returns 100", () => {
            expect(Integer_1.UInt64.from(100).toNumber()).toBe(100);
        });
        test("from(100).equals(100) returns true", () => {
            expect(Integer_1.UInt64.from(100).equals(100)).toBe(true);
        });
        test("from string creates correct value", () => {
            expect(Integer_1.UInt64.from("100").toNumber()).toBe(100);
        });
    });
    describe("Int32", () => {
        test("from(-1).toNumber() returns -1", () => {
            expect(Integer_1.Int32.from(-1).toNumber()).toBe(-1);
        });
        test("from max int32 value", () => {
            expect(Integer_1.Int32.from(2147483647).toNumber()).toBe(2147483647);
        });
    });
    describe("UInt8", () => {
        test("from(255).toNumber() returns 255", () => {
            expect(Integer_1.UInt8.from(255).toNumber()).toBe(255);
        });
        test("from(256) with truncate overflow wraps to 0", () => {
            const val = Integer_1.UInt8.from(256, "truncate");
            expect(val.toNumber()).toBe(0);
        });
    });
    describe("UInt16", () => {
        test("from(65535).toNumber() returns max uint16", () => {
            expect(Integer_1.UInt16.from(65535).toNumber()).toBe(65535);
        });
    });
    describe("UInt128", () => {
        test("from(0) creates zero value", () => {
            expect(Integer_1.UInt128.from(0).toNumber()).toBe(0);
        });
    });
    describe("arithmetic", () => {
        test("adding returns correct sum", () => {
            expect(Integer_1.UInt64.from(10).adding(Integer_1.UInt64.from(5)).toNumber()).toBe(15);
        });
        test("subtracting returns correct difference", () => {
            expect(Integer_1.UInt64.from(10).subtracting(Integer_1.UInt64.from(3)).toNumber()).toBe(7);
        });
        test("multiplying returns correct product", () => {
            expect(Integer_1.UInt64.from(6).multiplying(Integer_1.UInt64.from(7)).toNumber()).toBe(42);
        });
        test("dividing returns correct quotient", () => {
            expect(Integer_1.UInt64.from(20).dividing(Integer_1.UInt64.from(4)).toNumber()).toBe(5);
        });
    });
    describe("comparison", () => {
        test("gt returns true when greater", () => {
            expect(Integer_1.UInt64.from(10).gt(Integer_1.UInt64.from(5))).toBe(true);
        });
        test("gt returns false when less", () => {
            expect(Integer_1.UInt64.from(5).gt(Integer_1.UInt64.from(10))).toBe(false);
        });
        test("lt returns true when less", () => {
            expect(Integer_1.UInt64.from(5).lt(Integer_1.UInt64.from(10))).toBe(true);
        });
        test("lt returns false when greater", () => {
            expect(Integer_1.UInt64.from(10).lt(Integer_1.UInt64.from(5))).toBe(false);
        });
        test("gte returns true when equal", () => {
            expect(Integer_1.UInt64.from(10).gte(Integer_1.UInt64.from(10))).toBe(true);
        });
        test("lte returns true when equal", () => {
            expect(Integer_1.UInt64.from(10).lte(Integer_1.UInt64.from(10))).toBe(true);
        });
    });
    describe("random", () => {
        test("UInt32.random() returns a valid UInt32", () => {
            const val = Integer_1.UInt32.random();
            expect(val).toBeInstanceOf(Integer_1.UInt32);
            expect(val.toNumber()).toBeGreaterThanOrEqual(0);
        });
    });
    describe("VarUInt", () => {
        test("from(127) creates a valid value", () => {
            const val = Integer_1.VarUInt.from(127);
            expect(val.toNumber()).toBe(127);
        });
    });
    describe("VarInt", () => {
        test("from(-1) creates a valid value", () => {
            const val = Integer_1.VarInt.from(-1);
            expect(val.toNumber()).toBe(-1);
        });
    });
    describe("Int64", () => {
        test("from negative value", () => {
            expect(Integer_1.Int64.from(-100).toNumber()).toBe(-100);
        });
    });
});
//# sourceMappingURL=Integer.test.js.map