From 76088f686fa9df26ac69da103275a211c15de506 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 19 Dec 2021 23:57:36 -0500 Subject: [PATCH] are we missing something? --- .../test_basic_math/test_interpolation_3d.cpp | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/unit_tests/test_basic_math/test_interpolation_3d.cpp b/unit_tests/test_basic_math/test_interpolation_3d.cpp index a2200d2465..0b0e3a42bd 100644 --- a/unit_tests/test_basic_math/test_interpolation_3d.cpp +++ b/unit_tests/test_basic_math/test_interpolation_3d.cpp @@ -12,9 +12,12 @@ #include "interpolation.h" float rpmBins[5] = { 100, 200, 300, 400, 500 }; -float mafBins[4] = { 1, 2, 3, 4 }; +scaled_channel rpmBinsScaledByte[5] = { 100, 200, 30, 400, 500}; + +float mafBins[4] = { 1, 2, 3, 4 }; +scaled_channel mafBinsScaledInt[4] = { 1, 2, 3, 4 }; +scaled_channel mafBinsScaledByte[4] = { 1, 2, 3, 4 }; -scaled_channel mafBins2[4] = { 1, 2, 3, 4 }; float map[4][5] = { { 1, 2, 3, 4, 4}, @@ -26,21 +29,29 @@ float map[4][5] = { #define EXPECT_NEAR_M4(a, b) EXPECT_NEAR(a, b, 1e-4) static float getValue(float rpm, float maf) { - float result1, result2; - Map3D<5, 4, float, float, float> x1; x1.init(map, mafBins, rpmBins); - - result1 = x1.getValue(rpm, maf); + float result1 = x1.getValue(rpm, maf); Map3D<5, 4, float, float, int> x2; - x2.init(map, mafBins2, rpmBins); - - result2 = x2.getValue(rpm, maf); - + x2.init(map, mafBinsScaledInt, rpmBins); + float result2 = x2.getValue(rpm, maf); EXPECT_NEAR_M4(result1, result2); + + Map3D<5, 4, float, float, uint8_t> x3; + x3.init(map, mafBinsScaledByte, rpmBins); + float result3 = x3.getValue(rpm, maf); + EXPECT_NEAR_M4(result1, result3); + +/* +are we missing something in Map3D? + Map3D<5, 4, float, uint8_t, float> x4; + x4.init(map, mafBins, rpmBinsScaledByte); + float result4 = x4.getValue(rpm, maf); + EXPECT_NEAR_M4(result1, result4); +*/ return result1; }