Lines Matching +full:- +full:- +full:i

3  * SPDX-License-Identifier: Apache-2.0
20 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, -1)); in ZTEST()
22 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, x_axis[0] - 1)); in ZTEST()
38 for (int i = 0; i < ARRAY_SIZE(x_axis); i++) { in ZTEST() local
39 zassert_equal(y_axis[i], linear_interpolate(x_axis, y_axis, len, x_axis[i])); in ZTEST()
51 /* 0 to 4 -> 0 */ in ZTEST()
52 for (int i = 0; i < 5; i++) { in ZTEST() local
53 zassert_equal(0, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
55 /* 5 to 14 -> 1 */ in ZTEST()
56 for (int i = 5; i < 15; i++) { in ZTEST() local
57 zassert_equal(1, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
59 /* 15 to N -> 2 */ in ZTEST()
60 for (int i = 15; i <= 20; i++) { in ZTEST() local
61 zassert_equal(2, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
74 /* y = (x - 2000) / 10 */ in ZTEST()
75 for (int i = x_axis[0]; i <= x_axis[1]; i++) { in ZTEST() local
76 expected = round((i - 2000.0) / 10.0); in ZTEST()
77 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
83 int32_t y_axis[] = {-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0}; in ZTEST()
90 /* y = ((x - 2000) / 10) - 100 */ in ZTEST()
91 for (int i = x_axis[0]; i <= x_axis[len - 1]; i++) { in ZTEST() local
92 expected = round((i - 2000.0) / 10.0 - 100.0); in ZTEST()
93 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
100 int32_t x_axis[] = {-3000, -2900, -2800, -2700, -2600, -2500, in ZTEST()
101 -2400, -2300, -2200, -2100, -2000}; in ZTEST()
108 for (int i = x_axis[0]; i <= x_axis[len - 1]; i++) { in ZTEST() local
109 expected = round((i + 3000.0) / 10.0); in ZTEST()
110 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
116 int32_t y_axis[] = {-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0}; in ZTEST()
117 int32_t x_axis[] = {-3000, -2900, -2800, -2700, -2600, -2500, in ZTEST()
118 -2400, -2300, -2200, -2100, -2000}; in ZTEST()
124 /* y = ((x + 3000) / 10) - 100 */ in ZTEST()
125 for (int i = x_axis[0]; i <= x_axis[len - 1]; i++) { in ZTEST() local
126 expected = round((i + 3000.0) / 10.0 - 100.0); in ZTEST()
127 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
140 /* First line segment, y = 0.4x - 30 */ in ZTEST()
141 for (int i = x_axis[0]; i <= x_axis[1]; i++) { in ZTEST() local
142 expected = round(0.4 * i - 30.0); in ZTEST()
143 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
146 /* Second line segment, y = 1.6x - 210 */ in ZTEST()
147 for (int i = x_axis[1]; i <= x_axis[2]; i++) { in ZTEST() local
148 expected = round(1.6 * i - 210.0); in ZTEST()
149 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
152 /* Third line segment, y = 390 - 1.4x */ in ZTEST()
153 for (int i = x_axis[2]; i <= x_axis[3]; i++) { in ZTEST() local
154 expected = round(390.0 - 1.4 * i); in ZTEST()
155 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()
158 /* Fourth line segment, y = 240 - 0.8x */ in ZTEST()
159 for (int i = x_axis[3]; i <= x_axis[4]; i++) { in ZTEST() local
160 expected = round(240.0 - 0.8 * i); in ZTEST()
161 zassert_equal(expected, linear_interpolate(x_axis, y_axis, len, i)); in ZTEST()