Skip to content

test: fix technical issue with min_element in reduce tests#26533

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-reduce-test
Nov 27, 2024
Merged

test: fix technical issue with min_element in reduce tests#26533
asmorkalov merged 1 commit intoopencv:4.xfrom
mshabunin:fix-reduce-test

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

Compiling and running core tests with libc++ with debug hardening mode produces following error (Core_reduceArgMinMax):

/usr/local/include/c++/v1/__algorithm/comp_ref_type.h:47: 
    assertion !__comp_(__l, __r) failed: Comparator does not induce a strict weak ordering

Perhaps we should not use std::min_element with std::less_equal. E.g. C++-17 (?) (N4659) standard says:

28.7

  1. For all algorithms that take Compare, there is a version that uses operator< instead.
    That is, comp(*i, *j) != false defaults to *i < *j != false. For algorithms other than those
    described in 28.7.3 (binary_search etc.), comp shall induce a strict weak ordering on the values.

This might look a bit pedantic, but since this is just test I think we can fix this problem.

@asmorkalov asmorkalov added this to the 4.11.0 milestone Nov 27, 2024
@asmorkalov asmorkalov self-requested a review November 27, 2024 06:07
@asmorkalov asmorkalov self-assigned this Nov 27, 2024
@asmorkalov asmorkalov merged commit c8c64f6 into opencv:4.x Nov 27, 2024
@mshabunin mshabunin deleted the fix-reduce-test branch November 27, 2024 16:22
@asmorkalov asmorkalov mentioned this pull request Nov 28, 2024
@asmorkalov asmorkalov mentioned this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants