Skip to content

Commit

Permalink
more tests. bump to 0.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGraey committed Jul 17, 2022
1 parent 06ee608 commit 3683da5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions assembly/__tests__/u128.spec.as.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,37 @@ describe("String Conversion", () => {
it("Should convert to decimal string 1", () => {
var a = new u128(10248516654965971928, 5);
expect('102482237023513730008').toStrictEqual(a.toString());
expect('58e3a0b9945ebdbd8').toStrictEqual(a.toString(16));
});

it("Should convert to decimal string 2", () => {
var a = u128.Max;
expect('340282366920938463463374607431768211455').toStrictEqual(a.toString());
expect('ffffffffffffffffffffffffffffffff').toStrictEqual(a.toString(16));
});

it("Should convert to decimal string 3", () => {
var a = u128.Zero;
expect('0').toStrictEqual(a.toString());
expect('0').toStrictEqual(a.toString(16));
});

it("Should convert to decimal string 4", () => {
var a = u128.from(90);
expect('90').toStrictEqual(a.toString());
expect('5a').toStrictEqual(a.toString(16));
});

it("Should convert to decimal string 5", () => {
var a = u128.Max;
expect('ffffffffffffffffffffffffffffffff').toStrictEqual(a.toString(16));
var a = new u128(u64.MAX_VALUE);
expect('18446744073709551615').toStrictEqual(a.toString());
expect('ffffffffffffffff').toStrictEqual(a.toString(16));
});

it("Should convert to decimal string 6", () => {
var a = new u128(u64.MAX_VALUE - 1, u64.MAX_VALUE - 1);
expect('340282366920938463444927863358058659838').toStrictEqual(a.toString());
expect('fffffffffffffffefffffffffffffffe').toStrictEqual(a.toString(16));
});

it("Should convert from decimal string 1", () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "as-bignum",
"version": "0.2.19",
"version": "0.2.20",
"description": "128 and 256 bits integer and fixed point arithmetics for AssemblyScript. Also support checking overflow/underflow",
"main": "js/index.js",
"types": "assembly/index.ts",
Expand Down

0 comments on commit 3683da5

Please sign in to comment.