{"version":3,"sources":["../../src/utils/BigNumber.spec.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\"\nimport { BigNumber, BigNumberSource } from \"./BigNumber\"\n\ndescribe(\"BigNumber\", () => {\n  describe(\"round\", () => {\n    describe(\"roundHalfEven\", () => {\n      it(\"should round to the nearest even number\", () => {\n        const t = (\n          expected: BigNumberSource,\n          value: BigNumberSource,\n          precision: number,\n        ): void => {\n          expect(\n            BigNumber.round(\n              {\n                precision,\n                roundingMode: BigNumber.roundHalfEven,\n              },\n              value,\n            ),\n            `t(\"${expected}\", \"${value}\", ${precision})`,\n          ).toEqual(BigNumber.from(expected))\n        }\n\n        t(\"123.4\", \"123.45\", 1)\n        t(\"123.4\", \"123.35\", 1)\n        t(\"123.4\", \"123.41\", 1)\n        t(\"123.4\", \"123.36\", 1)\n      })\n    })\n  })\n\n  describe(\"sum\", () => {\n    it(\"should return the sum of an array of BigNumber values\", () => {\n      const numbers = [1, BigNumber.from(2), \"3\"]\n      expect(BigNumber.sum(numbers)).toEqual(BigNumber.from(6))\n    })\n  })\n\n  describe(\"getDecimalPart\", () => {\n    it(\"should return the decimal part of a BigNumber value\", () => {\n      expect(BigNumber.getDecimalPart({ precision: 10 }, \"123.45\")).toEqual(\n        \"45\",\n      )\n    })\n  })\n})\n"],"mappings":";;;;;;;AAAA,SAAS,UAAU,QAAQ,UAAU;AAGrC,SAAS,aAAa,MAAM;AAC1B,WAAS,SAAS,MAAM;AACtB,aAAS,iBAAiB,MAAM;AAC9B,SAAG,2CAA2C,MAAM;AAClD,cAAM,IAAI,CACR,UACA,OACA,cACS;AACT;AAAA,YACE,UAAU;AAAA,cACR;AAAA,gBACE;AAAA,gBACA,cAAc,UAAU;AAAA,cAC1B;AAAA,cACA;AAAA,YACF;AAAA,YACA,MAAM,QAAQ,OAAO,KAAK,MAAM,SAAS;AAAA,UAC3C,EAAE,QAAQ,UAAU,KAAK,QAAQ,CAAC;AAAA,QACpC;AAEA,UAAE,SAAS,UAAU,CAAC;AACtB,UAAE,SAAS,UAAU,CAAC;AACtB,UAAE,SAAS,UAAU,CAAC;AACtB,UAAE,SAAS,UAAU,CAAC;AAAA,MACxB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AAED,WAAS,OAAO,MAAM;AACpB,OAAG,yDAAyD,MAAM;AAChE,YAAM,UAAU,CAAC,GAAG,UAAU,KAAK,CAAC,GAAG,GAAG;AAC1C,aAAO,UAAU,IAAI,OAAO,CAAC,EAAE,QAAQ,UAAU,KAAK,CAAC,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH,CAAC;AAED,WAAS,kBAAkB,MAAM;AAC/B,OAAG,uDAAuD,MAAM;AAC9D,aAAO,UAAU,eAAe,EAAE,WAAW,GAAG,GAAG,QAAQ,CAAC,EAAE;AAAA,QAC5D;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}