Curves: Unit tests for curves::nurbs::calculate_evaluated_num()
Unit tests veryfying expectation for curves::nurbs::calculate_evaluated_num(). Expectation is computed from closed form expressions rather then hard coded values. Purpose for this is to make the tests easier to adjust if, for example, parameter sampling pattern is changed. It should also make them easier to read and understand. Additional purpose is to create a baseline and verify changes for #144000. Implementation is essentially examples from: https://link.springer.com/book/10.1007/978-3-642-59223-2 Pull Request: https://projects.blender.org/blender/blender/pulls/143920
This commit is contained in:
committed by
Hans Goudey
parent
c3688f7bb7
commit
a57c3558cd
@@ -153,6 +153,19 @@ inline void EXPECT_EQ_SPAN(const blender::Span<T> expected, const blender::Span<
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline void EXPECT_NEAR_SPAN(const blender::Span<T> expected,
|
||||
const blender::Span<T> actual,
|
||||
const U tolerance)
|
||||
{
|
||||
EXPECT_EQ(expected.size(), actual.size());
|
||||
if (expected.size() == actual.size()) {
|
||||
for (const int64_t i : expected.index_range()) {
|
||||
EXPECT_NEAR(expected[i], actual[i], tolerance) << "Element mismatch at index " << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void EXPECT_EQ_ARRAY(const T *expected, const T *actual, const size_t N)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user