Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  utils.c

  Sprache: C
 

// SPDX-License-Identifier: GPL-2.0-only
/*
 * KUnit tests for utilities
 *
 * Copyright (C) 2024-2025 Intel Corporation
 */

#include "../iwl-utils.h"
#include <kunit/test.h>

MODULE_IMPORT_NS("IWLWIFI");

static const struct average_neg_db_case {
 const char *desc;
 u8 neg_dbm[22];
 s8 result;
} average_neg_db_cases[] = {
 {
  .desc = "Smallest possible value, all filled",
  .neg_dbm = {
   128128128128128128128128128128,
   128128128128128128128128128128,
   128128
  },
  .result = -128,
 },
 {
  .desc = "Biggest possible value, all filled",
  .neg_dbm = {
   0000000000,
   0000000000,
   00,
  },
  .result = 0,
 },
 {
  .desc = "Smallest possible value, partial filled",
  .neg_dbm = {
   128128128128128128128128128128,
   0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff,
  },
  .result = -128,
 },
 {
  .desc = "Biggest possible value, partial filled",
  .neg_dbm = {
   0000000000,
   0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff,
  },
  .result = 0,
 },
 {
  .desc = "Adding -80dBm to -75dBm until it is still rounded to -79dBm",
  .neg_dbm = {
   75808080808080808080,
   808080808080800xff, 0xff, 0xff,
   0xff, 0xff,
  },
  .result = -79,
 },
 {
  .desc = "Adding -80dBm to -75dBm until it is just rounded to -80dBm",
  .neg_dbm = {
   75808080808080808080,
   80808080808080800xff, 0xff,
   0xff, 0xff,
  },
  .result = -80,
 },
};

KUNIT_ARRAY_PARAM_DESC(average_neg_db, average_neg_db_cases, desc)

static void test_average_neg_db(struct kunit *test)
{
 const struct average_neg_db_case *params = test->param_value;
 u8 reversed[ARRAY_SIZE(params->neg_dbm)];
 int i;

 /* Test the values in the given order */
 KUNIT_ASSERT_EQ(test,
   iwl_average_neg_dbm(params->neg_dbm,
         ARRAY_SIZE(params->neg_dbm)),
   params->result);

 /* Test in reverse order */
 for (i = 0; i < ARRAY_SIZE(params->neg_dbm); i++)
  reversed[ARRAY_SIZE(params->neg_dbm) - i - 1] =
   params->neg_dbm[i];
 KUNIT_ASSERT_EQ(test,
   iwl_average_neg_dbm(reversed,
         ARRAY_SIZE(params->neg_dbm)),
   params->result);
}

static struct kunit_case average_db_case[] = {
 KUNIT_CASE_PARAM(test_average_neg_db, average_neg_db_gen_params),
 {}
};

static struct kunit_suite average_db = {
 .name = "iwl-average-db",
 .test_cases = average_db_case,
};

kunit_test_suite(average_db);

Messung V0.5 in Prozent
C=95 H=94 G=94

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-06-07) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=434850
#Domains=655579