From patchwork Sat Jun 27 15:46:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6685261 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 71011C05AC for ; Sat, 27 Jun 2015 15:46:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72CD4204EB for ; Sat, 27 Jun 2015 15:46:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 481E8204D5 for ; Sat, 27 Jun 2015 15:46:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B4F46E11A; Sat, 27 Jun 2015 08:46:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id B5BDF6E11A for ; Sat, 27 Jun 2015 08:46:47 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 27 Jun 2015 08:46:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,689,1427785200"; d="scan'208";a="751562668" Received: from kczmudzi-mobl4.amr.corp.intel.com (HELO strange.ger.corp.intel.com) ([10.252.53.243]) by fmsmga002.fm.intel.com with ESMTP; 27 Jun 2015 08:46:46 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Sat, 27 Jun 2015 16:46:45 +0100 Message-Id: <1435420005-6992-1-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 Subject: [Intel-gfx] [PATCH i-g-t] stats: Test we do correctly invalidate the sorted array X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Chris had a doubt, and I was lazy and didn't do a similar test for the quartiles/median than for the mean (test_invalidate_mean()). Plug that gap. Signed-off-by: Damien Lespiau --- lib/tests/igt_stats.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/tests/igt_stats.c b/lib/tests/igt_stats.c index c0649f3..dfdc507 100644 --- a/lib/tests/igt_stats.c +++ b/lib/tests/igt_stats.c @@ -120,6 +120,24 @@ static void test_quartiles(void) igt_stats_fini(&stats); } +static void test_invalidate_sorted(void) +{ + igt_stats_t stats; + static const uint64_t s1_truncated[] = + { 47, 49, 6, 7, 15, 36, 39, 40, 41, 42}; + double median1, median2; + + igt_stats_init(&stats, ARRAY_SIZE(s1_truncated) + 1); + igt_stats_push_array(&stats, s1_truncated, ARRAY_SIZE(s1_truncated)); + median1 = igt_stats_get_median(&stats); + + igt_stats_push(&stats, 43); + median2 = igt_stats_get_median(&stats); + + igt_assert_eq_double(median2, 40); + igt_assert(median1 != median2); +} + static void test_mean(void) { igt_stats_t stats; @@ -193,6 +211,7 @@ igt_simple_main test_min_max(); test_range(); test_quartiles(); + test_invalidate_sorted(); test_mean(); test_invalidate_mean(); test_std_deviation();