From e33814c65b0bfcfcdacb1901ec8760c3c1015a3a Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Fri, 13 Jun 2025 12:09:38 +0200 Subject: [PATCH] test: ipa: Add failing test for single point Pwl Sometimes it is useful to have a Pwl with only a single point defined. A practical use case is tuning files with only a single entry for Pwl related parameters, where the expectation is that this entry just gets used. Add a failing test case for such a single point Pwl. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham --- test/ipa/libipa/meson.build | 2 +- test/ipa/libipa/pwl.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build index b2cc4b74..c553366a 100644 --- a/test/ipa/libipa/meson.build +++ b/test/ipa/libipa/meson.build @@ -4,7 +4,7 @@ libipa_test = [ {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']}, {'name': 'histogram', 'sources': ['histogram.cpp']}, {'name': 'interpolator', 'sources': ['interpolator.cpp']}, - {'name': 'pwl', 'sources': ['pwl.cpp']}, + {'name': 'pwl', 'sources': ['pwl.cpp'], 'should_fail': true }, ] foreach test : libipa_test diff --git a/test/ipa/libipa/pwl.cpp b/test/ipa/libipa/pwl.cpp index d41a290a..6640b1ab 100644 --- a/test/ipa/libipa/pwl.cpp +++ b/test/ipa/libipa/pwl.cpp @@ -43,6 +43,13 @@ protected: ASSERT_EQ(pwl.size(), 2); + /* Test degenerate PWL. */ + pwl.clear(); + pwl.append(1, 1); + ASSERT_EQ(pwl.eval(0), 1); + ASSERT_EQ(pwl.eval(1), 1); + ASSERT_EQ(pwl.eval(2), 1); + return TestPass; } };