cleanup of various warnings from clangd (#3682)

* cleanup of various warnings from clangs
* lfrfid_debug: cast fixes
* subghz: binraw: round->roundf
* furi: thread: updated internal stack size variable to size_t
* github: fail faster on unsuccessful build
* unit_tests: double trouble
This commit is contained in:
hedger
2024-06-03 17:43:23 +04:00
committed by GitHub
parent 0d4ead8fbd
commit 03196fa110
136 changed files with 127 additions and 196 deletions

View File

@@ -1,5 +1,5 @@
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <bit_lib/bit_lib.h>
MU_TEST(test_bit_lib_increment_index) {

View File

@@ -1,6 +1,6 @@
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <bt/bt_service/bt_keys_storage.h>
#include <storage/storage.h>

View File

@@ -1,4 +1,4 @@
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <toolbox/compress.h>

View File

@@ -1,5 +1,5 @@
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <datetime/datetime.h>

View File

@@ -1,6 +1,6 @@
#include <dialogs/dialogs.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
MU_TEST(test_dialog_file_browser_set_basic_options_should_init_all_fields) {
mu_assert(

View File

@@ -1,4 +1,4 @@
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <furi.h>
#include <m-dict.h>
#include <toolbox/dir_walk.h>

View File

@@ -1,4 +1,4 @@
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <furi.h>
#include <furi_hal_random.h>

View File

@@ -2,7 +2,7 @@
#include <flipper_format/flipper_format.h>
#include <flipper_format/flipper_format_i.h>
#include <toolbox/stream/stream.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#define TEST_DIR TEST_DIR_NAME "/"
#define TEST_DIR_NAME EXT_PATH("unit_tests_tmp")

View File

@@ -3,7 +3,7 @@
#include <flipper_format/flipper_format_i.h>
#include <toolbox/stream/stream.h>
#include <storage/storage.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
static const char* test_filetype = "Flipper Format test";
static const uint32_t test_version = 666;

View File

@@ -1,7 +1,7 @@
#include <float.h>
#include <float_tools.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
MU_TEST(float_tools_equal_test) {
mu_check(float_is_equal(FLT_MAX, FLT_MAX));

View File

@@ -1,4 +1,4 @@
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

View File

@@ -1,7 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
const uint32_t context_value = 0xdeadbeef;
const uint32_t notify_value_0 = 0x12345678;

View File

@@ -1,7 +1,5 @@
#include <stdio.h>
#include <string.h>
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#define TEST_RECORD_NAME "test/holding"

View File

@@ -1,7 +1,6 @@
#include <stdio.h>
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
// v2 tests
void test_furi_create_open(void);

View File

@@ -1,11 +1,9 @@
#include "furi_hal_rtc.h"
#include <stdint.h>
#include <stdio.h>
#include <furi.h>
#include <furi_hal.h>
#include <lp5562_reg.h>
#include "../test.h"
#include <stdlib.h>
#include "../test.h" // IWYU pragma: keep
#define DATA_SIZE 4
#define EEPROM_ADDRESS 0b10101000

View File

@@ -1,7 +1,6 @@
#include <stdio.h>
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
static const uint8_t key_ctr_1[32] = {
0x77, 0x6B, 0xEF, 0xF2, 0x85, 0x1D, 0xB0, 0x6F, 0x4C, 0x8A, 0x05, 0x42, 0xC8, 0x69, 0x6F, 0x6C,

View File

@@ -1,5 +1,5 @@
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
static void test_setup(void) {
}

View File

@@ -2,7 +2,7 @@
#include <flipper_format.h>
#include <infrared.h>
#include <common/infrared_common_i.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/")
#define IR_TEST_FILE_PREFIX "test_"

View File

@@ -1,5 +1,5 @@
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <toolbox/protocols/protocol_dict.h>
#include <lfrfid/protocols/lfrfid_protocols.h>
#include <toolbox/pulse_protocols/pulse_glue.h>

View File

@@ -1,5 +1,5 @@
#include <furi.c>
#include "../test.h"
#include <furi.h>
#include "../test.h" // IWYU pragma: keep
#include <update_util/resources/manifest.h>
#define TAG "Manifest"

View File

@@ -24,7 +24,7 @@
#include <toolbox/keys_dict.h>
#include <nfc/nfc.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#define TAG "NfcTest"

View File

@@ -1,6 +1,6 @@
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
static void power_test_deinit(void) {
// Try to reset to default charge voltage limit
@@ -13,46 +13,47 @@ MU_TEST(test_power_charge_voltage_limit_exact) {
//
// This test may need adapted if other charge controllers are used in the future.
for(uint16_t charge_mv = 3840; charge_mv <= 4208; charge_mv += 16) {
float charge_volt = (float)charge_mv / 1000.0f;
float charge_volt = (float)charge_mv / 1000;
furi_hal_power_set_battery_charge_voltage_limit(charge_volt);
mu_assert_double_eq(charge_volt, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(
(double)charge_volt, (double)furi_hal_power_get_battery_charge_voltage_limit());
}
}
MU_TEST(test_power_charge_voltage_limit_floating_imprecision) {
// 4.016f should act as 4.016 V, even with floating point imprecision
furi_hal_power_set_battery_charge_voltage_limit(4.016f);
mu_assert_double_eq(4.016f, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(4.016, (double)furi_hal_power_get_battery_charge_voltage_limit());
}
MU_TEST(test_power_charge_voltage_limit_inexact) {
// Charge voltage limits that are not power of 16mV get truncated down
furi_hal_power_set_battery_charge_voltage_limit(3.841f);
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(3.840, (double)furi_hal_power_get_battery_charge_voltage_limit());
furi_hal_power_set_battery_charge_voltage_limit(3.900f);
mu_assert_double_eq(3.888, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(3.888, (double)furi_hal_power_get_battery_charge_voltage_limit());
furi_hal_power_set_battery_charge_voltage_limit(4.200f);
mu_assert_double_eq(4.192, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(4.192, (double)furi_hal_power_get_battery_charge_voltage_limit());
}
MU_TEST(test_power_charge_voltage_limit_invalid_clamped) {
// Out-of-range charge voltage limits get clamped to 3.840 V and 4.208 V
furi_hal_power_set_battery_charge_voltage_limit(3.808f);
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(3.840, (double)furi_hal_power_get_battery_charge_voltage_limit());
furi_hal_power_set_battery_charge_voltage_limit(1.0f);
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(3.840, (double)furi_hal_power_get_battery_charge_voltage_limit());
// NOTE: Intentionally picking a small increment above 4.208 V to reduce the risk of an
// unhappy battery if this fails.
furi_hal_power_set_battery_charge_voltage_limit(4.240f);
mu_assert_double_eq(4.208, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(4.208, (double)furi_hal_power_get_battery_charge_voltage_limit());
// Likewise, picking a number that the uint8_t wraparound in the driver would result in a
// VREG value under 23 if this test fails.
// E.g. (uint8_t)((8105-3840)/16) -> 10
furi_hal_power_set_battery_charge_voltage_limit(8.105f);
mu_assert_double_eq(4.208, furi_hal_power_get_battery_charge_voltage_limit());
mu_assert_double_eq(4.208, (double)furi_hal_power_get_battery_charge_voltage_limit());
}
MU_TEST_SUITE(test_power_suite) {

View File

@@ -1,5 +1,5 @@
#include <furi.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <toolbox/protocols/protocol_dict.h>
typedef enum {

View File

@@ -17,7 +17,7 @@
#include <lib/toolbox/path.h>
#include <m-list.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <protobuf_version.h>
#include <pb.h>

View File

@@ -1,4 +1,4 @@
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <furi.h>
#include <storage/storage.h>

View File

@@ -4,7 +4,7 @@
#include <toolbox/stream/file_stream.h>
#include <toolbox/stream/buffered_file_stream.h>
#include <storage/storage.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
static const char* stream_test_data = "I write differently from what I speak, "
"I speak differently from what I think, "

View File

@@ -1,6 +1,6 @@
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <lib/subghz/receiver.h>
#include <lib/subghz/transmitter.h>
#include <lib/subghz/subghz_keystore.h>

View File

@@ -1,7 +1,7 @@
#include <furi.h>
#include <furi_hal.h>
#include "../test.h"
#include "../test.h" // IWYU pragma: keep
#include <toolbox/varint.h>
#include <toolbox/profiler.h>