mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Icons: compression fixes & larger dimension support (#3564)
* toolbox, gui: fixes for compressed icon handling * ufbt: fixes for generated vscode project * scripts: increased max dimensions for image converter * icon type changes * linter fixes; api sync * gui: docs fix * toolbox: fixed potential decoder buffer overflow * minor cleanup * fbt: sdk: suppressed deprecation warnings in API table * toolbox: compress: added unit tests vscode: now installs resources for unit_tests unit_tests: now loads subghz region data * toolbox: compress: review fixes, pt 1 * compress: now passes decoder buffer size as constructor argument; auto-resize decoder buffer; crash on failed icon decompression * PVS fixes * pvs fixes, pt2 * doxygen fixes * investigating unit test failures * investigating unit test failures * investigating unit test failures * investigating unit test failures * investigating unit test failures * UnitTests: move all tests into plugins, brakes testing * UnitTests: add plugin API and update plugin entrypoints * UniTests: Test runner that works with plugins * fbt: extra filtering for extapps to include in build * UnitTests: filter tests by name * loader: restored API table for unit_test build config * Add various missing symbols to API table * UnitTest: fail on plugin load error * UnitTests: cleanup plugin api and reporting * unit_tests: composite resolver * UnitTests: remove unused declaration * unit_tests, nfc: moved mock nfc implementation to libnfc * unit_tests: api: removed redundant #define * toolbox: compress: removed size_hint for icons; triggering furi_check on oversized icons * gui: icon, icon_animation: removed size hit APIs * Format Sources. Cleanup code. * loader: refuse to start .fal as app * toolbox: compress: fixed memory corruption in operations with small destination buffer; added unit tests for that case * unit_tests: proper test skipping; better selective test interface * unit_tests: moved 'loading' logging to proper location Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#include <float.h>
|
||||
#include <float_tools.h>
|
||||
|
||||
#include "../test.h"
|
||||
|
||||
MU_TEST(float_tools_equal_test) {
|
||||
mu_check(float_is_equal(FLT_MAX, FLT_MAX));
|
||||
mu_check(float_is_equal(FLT_MIN, FLT_MIN));
|
||||
mu_check(float_is_equal(-FLT_MAX, -FLT_MAX));
|
||||
mu_check(float_is_equal(-FLT_MIN, -FLT_MIN));
|
||||
|
||||
mu_check(!float_is_equal(FLT_MIN, FLT_MAX));
|
||||
mu_check(!float_is_equal(-FLT_MIN, FLT_MAX));
|
||||
mu_check(!float_is_equal(FLT_MIN, -FLT_MAX));
|
||||
mu_check(!float_is_equal(-FLT_MIN, -FLT_MAX));
|
||||
|
||||
const float pi = 3.14159f;
|
||||
mu_check(float_is_equal(pi, pi));
|
||||
mu_check(float_is_equal(-pi, -pi));
|
||||
mu_check(!float_is_equal(pi, -pi));
|
||||
mu_check(!float_is_equal(-pi, pi));
|
||||
|
||||
const float one_third = 1.f / 3.f;
|
||||
const float one_third_dec = 0.3333333f;
|
||||
mu_check(one_third != one_third_dec);
|
||||
mu_check(float_is_equal(one_third, one_third_dec));
|
||||
|
||||
const float big_num = 1.e12f;
|
||||
const float med_num = 95.389f;
|
||||
const float smol_num = 1.e-12f;
|
||||
mu_check(float_is_equal(big_num, big_num));
|
||||
mu_check(float_is_equal(med_num, med_num));
|
||||
mu_check(float_is_equal(smol_num, smol_num));
|
||||
mu_check(!float_is_equal(smol_num, big_num));
|
||||
mu_check(!float_is_equal(med_num, smol_num));
|
||||
mu_check(!float_is_equal(big_num, med_num));
|
||||
|
||||
const float more_than_one = 1.f + FLT_EPSILON;
|
||||
const float less_than_one = 1.f - FLT_EPSILON;
|
||||
mu_check(!float_is_equal(more_than_one, less_than_one));
|
||||
mu_check(!float_is_equal(more_than_one, -less_than_one));
|
||||
mu_check(!float_is_equal(-more_than_one, less_than_one));
|
||||
mu_check(!float_is_equal(-more_than_one, -less_than_one));
|
||||
|
||||
const float slightly_more_than_one = 1.f + FLT_EPSILON / 2.f;
|
||||
const float slightly_less_than_one = 1.f - FLT_EPSILON / 2.f;
|
||||
mu_check(float_is_equal(slightly_more_than_one, slightly_less_than_one));
|
||||
mu_check(float_is_equal(-slightly_more_than_one, -slightly_less_than_one));
|
||||
mu_check(!float_is_equal(slightly_more_than_one, -slightly_less_than_one));
|
||||
mu_check(!float_is_equal(-slightly_more_than_one, slightly_less_than_one));
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(float_tools_suite) {
|
||||
MU_RUN_TEST(float_tools_equal_test);
|
||||
}
|
||||
|
||||
int run_minunit_test_float_tools(void) {
|
||||
MU_RUN_SUITE(float_tools_suite);
|
||||
return MU_EXIT_CODE;
|
||||
}
|
||||
|
||||
TEST_API_DEFINE(run_minunit_test_float_tools)
|
||||
Reference in New Issue
Block a user