|
|
@@ -62,25 +62,45 @@
|
|
|
/**
|
|
|
* Assert that buffers A and B are byte-equivalent for a number of bytes.
|
|
|
*/
|
|
|
+#if defined(DUMPPATTERN)
|
|
|
#define TEST_ASSERT_BUFFERS_EQUAL(buf_a, buf_b, bytes) \
|
|
|
do \
|
|
|
{ \
|
|
|
if (memcmp(buf_a, buf_b, bytes) != 0) \
|
|
|
{ \
|
|
|
+ JTEST_DUMP_STRF("%s","DUMP PATTERNS\n"); \
|
|
|
+ for(unsigned long i=0;i < bytes; i++) \
|
|
|
+ { \
|
|
|
+ /*JTEST_DUMP_STRF("%0x %0x\n", *a,*b);*/\
|
|
|
+ } \
|
|
|
return JTEST_TEST_FAILED; \
|
|
|
} \
|
|
|
} while (0)
|
|
|
|
|
|
+#else
|
|
|
+
|
|
|
+#define TEST_ASSERT_BUFFERS_EQUAL(buf_a, buf_b, bytes)\
|
|
|
+ do \
|
|
|
+ { \
|
|
|
+ if (memcmp(buf_a, buf_b, bytes) != 0) \
|
|
|
+ { \
|
|
|
+ return JTEST_TEST_FAILED; \
|
|
|
+ } \
|
|
|
+ } while (0)
|
|
|
+
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
/**
|
|
|
* Assert that the two entities are equal.
|
|
|
*/
|
|
|
-#define TEST_ASSERT_EQUAL(a, b) \
|
|
|
- do \
|
|
|
- { \
|
|
|
- if ((a) != (b)) \
|
|
|
- { \
|
|
|
- return JTEST_TEST_FAILED; \
|
|
|
- } \
|
|
|
+#define TEST_ASSERT_EQUAL(a, b) \
|
|
|
+ do \
|
|
|
+ { \
|
|
|
+ if ((a) != (b)) \
|
|
|
+ { \
|
|
|
+ return JTEST_TEST_FAILED;\
|
|
|
+ } \
|
|
|
} while (0)
|
|
|
|
|
|
/**
|
|
|
@@ -111,31 +131,74 @@
|
|
|
* Assert that the SNR between a reference and test sample is above a given
|
|
|
* threshold.
|
|
|
*/
|
|
|
-#define TEST_ASSERT_SNR(ref_ptr, tst_ptr, block_size, threshold) \
|
|
|
+#if defined(DUMPPATTERN)
|
|
|
+
|
|
|
+#define TEST_ASSERT_SNR(ref_ptr, tst_ptr, block_size, threshold) \
|
|
|
+ do \
|
|
|
+ { \
|
|
|
+ float32_t snr = arm_snr_f32(ref_ptr, tst_ptr, block_size);\
|
|
|
+ if ( snr <= threshold) \
|
|
|
+ { \
|
|
|
+ JTEST_DUMP_STRF("%s","DUMP PATTERNS\n"); \
|
|
|
+ for(unsigned long i=0;i < block_size; i++) \
|
|
|
+ { \
|
|
|
+ /*JTEST_DUMP_STRF("%f %f\n", ref_ptr[i],tst_ptr[i]);*/\
|
|
|
+ } \
|
|
|
+ JTEST_DUMP_STRF("SNR: %f\n", snr); \
|
|
|
+ return JTEST_TEST_FAILED; \
|
|
|
+ } \
|
|
|
+ } while (0)
|
|
|
+
|
|
|
+#else
|
|
|
+
|
|
|
+#define TEST_ASSERT_SNR(ref_ptr, tst_ptr, block_size, threshold) \
|
|
|
+ do \
|
|
|
+ { \
|
|
|
+ float32_t snr = arm_snr_f32(ref_ptr, tst_ptr, block_size);\
|
|
|
+ if ( snr <= threshold) \
|
|
|
+ { \
|
|
|
+ JTEST_DUMP_STRF("SNR: %f\n", snr); \
|
|
|
+ return JTEST_TEST_FAILED; \
|
|
|
+ } \
|
|
|
+ } while (0)
|
|
|
+
|
|
|
+#endif
|
|
|
+/**
|
|
|
+ * Assert that the SNR between a reference and test sample is above a given
|
|
|
+ * threshold. Special case for float64_t
|
|
|
+ */
|
|
|
+#if defined(DUMPPATTERN)
|
|
|
+
|
|
|
+#define TEST_ASSERT_DBL_SNR(ref_ptr, tst_ptr, block_size, threshold)\
|
|
|
do \
|
|
|
{ \
|
|
|
- float32_t snr = arm_snr_f32(ref_ptr, tst_ptr, block_size); \
|
|
|
- if ( snr <= threshold) \
|
|
|
+ float64_t snr = arm_snr_f64(ref_ptr, tst_ptr, block_size); \
|
|
|
+ if ( snr <= threshold) \
|
|
|
{ \
|
|
|
+ JTEST_DUMP_STRF("%s","DUMP PATTERNS\n"); \
|
|
|
+ for(unsigned long i=0;i < block_size; i++) \
|
|
|
+ { \
|
|
|
+ /* JTEST_DUMP_STRF("%f %f\n", ref_ptr[i],tst_ptr[i]);*/ \
|
|
|
+ } \
|
|
|
JTEST_DUMP_STRF("SNR: %f\n", snr); \
|
|
|
return JTEST_TEST_FAILED; \
|
|
|
} \
|
|
|
- } while (0) \
|
|
|
+ } while (0)
|
|
|
|
|
|
-/**
|
|
|
- * Assert that the SNR between a reference and test sample is above a given
|
|
|
- * threshold. Special case for float64_t
|
|
|
- */
|
|
|
-#define TEST_ASSERT_DBL_SNR(ref_ptr, tst_ptr, block_size, threshold) \
|
|
|
+#else
|
|
|
+
|
|
|
+#define TEST_ASSERT_DBL_SNR(ref_ptr, tst_ptr, block_size, threshold)\
|
|
|
do \
|
|
|
{ \
|
|
|
float64_t snr = arm_snr_f64(ref_ptr, tst_ptr, block_size); \
|
|
|
- if ( snr <= threshold) \
|
|
|
+ if ( snr <= threshold) \
|
|
|
{ \
|
|
|
JTEST_DUMP_STRF("SNR: %f\n", snr); \
|
|
|
return JTEST_TEST_FAILED; \
|
|
|
} \
|
|
|
- } while (0) \
|
|
|
+ } while (0)
|
|
|
+
|
|
|
+#endif
|
|
|
|
|
|
/**
|
|
|
* Compare test and reference elements by converting to float and
|