From 368eb4dfd45ae701f024c2c1cd72bcf6f759b8f2 Mon Sep 17 00:00:00 2001 From: Stanislav Sysoev Date: Wed, 29 Nov 2023 20:48:34 +1100 Subject: [PATCH] test: add negative values test --- test/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/index.js b/test/index.js index 982207b..a2ad7d6 100644 --- a/test/index.js +++ b/test/index.js @@ -38,6 +38,11 @@ test('percentile of simple values', t => { }); }); +test('percentile with negative values', t => { + t.is(percentile(50, shuffleArray([-1, -2, -3, -4, -5])), -3); + t.is(percentile(50, shuffleArray([7, 6, -1, -2, -3, -4, -5])), -2); +}); + test('percentile of simple values in a typed array', t => { stubsSimple.forEach(stub => { t.is(