summaryrefslogtreecommitdiff
path: root/test/accel_cal.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 15:19:22 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-28 23:22:10 +0000
commitd90feaba3df75c54ebafb8fc7c4524ddccce653d (patch)
treee23ad9b2eeb70b708b81db4de71477f18bc84c1e /test/accel_cal.c
parentdfe37ed6375e50d86eb10264840149977538fc3c (diff)
downloadchrome-ec-d90feaba3df75c54ebafb8fc7c4524ddccce653d.tar.gz
test/accel_cal.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ie53e1b5ab4e2130c81a5ce2dda82f501c1536bca Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730469 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'test/accel_cal.c')
-rw-r--r--test/accel_cal.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/test/accel_cal.c b/test/accel_cal.c
index 34fd5678c2..5c18ff0a91 100644
--- a/test/accel_cal.c
+++ b/test/accel_cal.c
@@ -29,12 +29,12 @@ struct accel_cal cal = {
static bool accumulate(float x, float y, float z, float temperature)
{
- return accel_cal_accumulate(&cal, 0, x, y, z, temperature)
- || accel_cal_accumulate(&cal, 200 * MSEC, x, y, z, temperature)
- || accel_cal_accumulate(&cal, 400 * MSEC, x, y, z, temperature)
- || accel_cal_accumulate(&cal, 600 * MSEC, x, y, z, temperature)
- || accel_cal_accumulate(&cal, 800 * MSEC, x, y, z, temperature)
- || accel_cal_accumulate(&cal, 1000 * MSEC, x, y, z, temperature);
+ return accel_cal_accumulate(&cal, 0, x, y, z, temperature) ||
+ accel_cal_accumulate(&cal, 200 * MSEC, x, y, z, temperature) ||
+ accel_cal_accumulate(&cal, 400 * MSEC, x, y, z, temperature) ||
+ accel_cal_accumulate(&cal, 600 * MSEC, x, y, z, temperature) ||
+ accel_cal_accumulate(&cal, 800 * MSEC, x, y, z, temperature) ||
+ accel_cal_accumulate(&cal, 1000 * MSEC, x, y, z, temperature);
}
DECLARE_EC_TEST(test_calibrated_correctly_with_kasa)
@@ -66,20 +66,16 @@ DECLARE_EC_TEST(test_calibrated_correctly_with_newton)
float kasa_radius;
int i;
float data[] = {
- 1.00290f, 0.09170f, 0.09649f,
- 0.95183f, 0.23626f, 0.25853f,
- 0.95023f, 0.15387f, 0.31865f,
- 0.97374f, 0.01639f, 0.27675f,
- 0.88521f, 0.30212f, 0.39558f,
- 0.92787f, 0.35157f, 0.21209f,
- 0.95162f, 0.33173f, 0.10924f,
- 0.98397f, 0.22644f, 0.07737f,
+ 1.00290f, 0.09170f, 0.09649f, 0.95183f, 0.23626f, 0.25853f,
+ 0.95023f, 0.15387f, 0.31865f, 0.97374f, 0.01639f, 0.27675f,
+ 0.88521f, 0.30212f, 0.39558f, 0.92787f, 0.35157f, 0.21209f,
+ 0.95162f, 0.33173f, 0.10924f, 0.98397f, 0.22644f, 0.07737f,
};
kasa_reset(&kasa);
for (i = 0; i < ARRAY_SIZE(data); i += 3) {
zassert_false(has_bias, NULL);
- kasa_accumulate(&kasa, data[i], data[i + 1], data[i + 2]);
+ kasa_accumulate(&kasa, data[i], data[i + 1], data[i + 2]);
has_bias = accumulate(data[i], data[i + 1], data[i + 2], 21.0f);
}
@@ -93,9 +89,9 @@ DECLARE_EC_TEST(test_calibrated_correctly_with_newton)
zassert_true(sqrtf(powf(cal.bias[X] - 0.01f, 2.0f) +
powf(cal.bias[Y] - 0.01f, 2.0f) +
powf(cal.bias[Z] - 0.01f, 2.0f)) <
- sqrtf(powf(kasa_bias[X] - 0.01f, 2.0f) +
- powf(kasa_bias[Y] - 0.01f, 2.0f) +
- powf(kasa_bias[Z] - 0.01f, 2.0f)),
+ sqrtf(powf(kasa_bias[X] - 0.01f, 2.0f) +
+ powf(kasa_bias[Y] - 0.01f, 2.0f) +
+ powf(kasa_bias[Z] - 0.01f, 2.0f)),
NULL);
return EC_SUCCESS;
@@ -125,7 +121,9 @@ void before_test(void)
accel_cal_reset(&cal);
}
-void after_test(void) {}
+void after_test(void)
+{
+}
TEST_MAIN()
{