github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/pages/math.spec.ts (about) 1 import { calculateMean, calculateStdDeviation } from './math'; 2 3 describe('math', () => { 4 describe('calculateMean, calculateStdDeviation', () => { 5 test.each([ 6 [[1, 2, 3, 4, 5], 1.4142135623730951], 7 [[23, 4, 6, 457, 65, 7, 45, 8], 145.13565852332775], 8 [[3456, 9876, 12, 0, 0, 99917, 1000000, 234543], 323657.1010328678], 9 ])( 10 'should calculate correct standart deviation', 11 (array, expectedValue) => { 12 const mean = calculateMean(array); 13 14 expect(calculateStdDeviation(array, mean)).toBe(expectedValue); 15 } 16 ); 17 }); 18 });