From e101f85d654593c8310dcc648c8776cd8b65a22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 8 Nov 2018 10:16:34 +0100 Subject: [PATCH] [apps/stast] Add test on median with null frequencies --- apps/statistics/test/store.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/apps/statistics/test/store.cpp b/apps/statistics/test/store.cpp index ecca0596e..edae7e805 100644 --- a/apps/statistics/test/store.cpp +++ b/apps/statistics/test/store.cpp @@ -205,6 +205,28 @@ QUIZ_CASE(data_statistics) { /* sum */ 6.0, /* squaredValueSum */ 12.0); + /* 1 2 3 4 + * 0 1 0 1 */ + double n8[4] = {1.0, 2.0, 3.0, 4.0}; + double v8[4] = {0.0, 1.0, 0.0, 1.0}; + assert_data_statictics_equal_to( + n8, + v8, + 4, + /* sumOfOccurrences */ 2.0, + /* maxValue */ 4.0, + /* minValue */ 2.0, + /* range */ 2.0, + /* mean */ 3.0, + /* variance */ 1.0, + /* standardDeviation */ 1.0, + /* sampleStandardDeviation */ 1.414, + /* firstQuartile */ 2.0, + /* thirdQuartile */ 4.0, + /* quartileRange */ 2.0, + /* median */ 3.0, + /* sum */ 6.0, + /* squaredValueSum */ 20.0); } }