From fa127f5f66187b3f444bcd1d1c40ff1fe38e6957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Sat, 2 May 2020 17:27:19 +0200 Subject: [PATCH] :bug: fix(Integer.toString): Remove side effects. Fixes #20. --- package.json | 2 +- test/src/Integer/toString.js | 8 +++++++- yarn.lock | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 82d6cf9..7c5b20d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@aureooms/js-error": "^4.0.0", - "@aureooms/js-integer-big-endian": "^5.0.0" + "@aureooms/js-integer-big-endian": "^5.0.1" }, "devDependencies": { "@aureooms/js-algorithms": "3.0.7", diff --git a/test/src/Integer/toString.js b/test/src/Integer/toString.js index 7dc18c0..60a5127 100644 --- a/test/src/Integer/toString.js +++ b/test/src/Integer/toString.js @@ -12,4 +12,10 @@ test( 'ZZ.from(3).pow(50).bin()' , t => { test( 'ZZ.from(3).pow(50).oct()' , t => { t.is(ZZ.from(3).pow(50).oct() , '230012517606662772047361711' ) ; } ) ; test( 'ZZ.from(3).pow(50).hex()' , t => { t.is(ZZ.from(3).pow(50).hex() , '980553f0db2fd09de3c9' ) ; } ) ; -// TODO test side effects of priting in an other base +test( 'toString is pure' , t => { + const x = ZZ.from(10000) ; + t.is('10000', x.toString(10)); + t.is('10000', x.toString(10)); + t.is('2710', x.toString(16)); + t.is('2710', x.toString(16)); +}) diff --git a/yarn.lock b/yarn.lock index 9d66e0f..7adf400 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,10 +17,10 @@ resolved "https://registry.yarnpkg.com/@aureooms/js-error/-/js-error-4.0.0.tgz#cea0a145f5290f443911b3d1890d7254a18eeb9b" integrity sha512-omwmz82cPxqRnorZ8tqeIcPj1QcJnCsMiVYcwOh/QfUXhJ+DmiBPgWOm5WWAQvQzYVKe0/k7+s2ie+UoRJagjA== -"@aureooms/js-integer-big-endian@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@aureooms/js-integer-big-endian/-/js-integer-big-endian-5.0.0.tgz#f16380210038e8f40dc1c160c5414981d1695e0e" - integrity sha512-dj5zu9FACN8Z6j0C5gu/0dGJ1idMAiO2zjw9XTK9qpbiiVrKw+cPgTmTAVxyu8B1zVo2TPh0K0do0dko1mjmTA== +"@aureooms/js-integer-big-endian@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@aureooms/js-integer-big-endian/-/js-integer-big-endian-5.0.1.tgz#a0c63b09f12513d72e1b99fb82f49c7023e5743a" + integrity sha512-iMBF2lWXwIeY2xeDsbpZJlQTD5yyf9OTZswR3fB3sSjNO7hCTrhGD+I0Y7Sz+jNFp68wDKM5FtKcVVGlHCiNhw== "@aureooms/js-operator@1.0.2": version "1.0.2"