|
|
@ -2,6 +2,7 @@ |
|
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
#include "test_precomp.hpp" |
|
|
|
#include "test_precomp.hpp" |
|
|
|
|
|
|
|
#include <cmath> |
|
|
|
|
|
|
|
|
|
|
|
namespace opencv_test { namespace { |
|
|
|
namespace opencv_test { namespace { |
|
|
|
|
|
|
|
|
|
|
@ -783,5 +784,18 @@ TEST(Core_Check, testSize_1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST(Core_Allocation, alignedAllocation) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// iterate from size=1 to approximate byte size of 8K 32bpp image buffer
|
|
|
|
|
|
|
|
for (int i = 0; i < 200; i++) { |
|
|
|
|
|
|
|
const size_t size = static_cast<size_t>(std::pow(1.091, (double)i)); |
|
|
|
|
|
|
|
void * const buf = cv::fastMalloc(size); |
|
|
|
|
|
|
|
ASSERT_NE((uintptr_t)0, (uintptr_t)buf) |
|
|
|
|
|
|
|
<< "failed to allocate memory"; |
|
|
|
|
|
|
|
ASSERT_EQ((uintptr_t)0, (uintptr_t)buf % CV_MALLOC_ALIGN) |
|
|
|
|
|
|
|
<< "memory not aligned to " << CV_MALLOC_ALIGN; |
|
|
|
|
|
|
|
cv::fastFree(buf); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}} // namespace
|
|
|
|
}} // namespace
|
|
|
|