[PPL-devel] [GIT] ppl/ppl(master): Encoded custom overflow conditions for digitalfilters1.cc tests 5 and 6.

Enea Zaffanella zaffanella at cs.unipr.it
Thu Mar 4 18:16:10 CET 2010


Module: ppl/ppl
Branch: master
Commit: be7b34ac18794498bbe6316fd831942a369c9cc4
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=be7b34ac18794498bbe6316fd831942a369c9cc4

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Thu Mar  4 17:57:23 2010 +0100

Encoded custom overflow conditions for digitalfilters1.cc tests 5 and 6.

---

 tests/Floating_Point_Expression/digitalfilters1.cc |   18 +++++++++++++++---
 tests/ppl_test.hh                                  |   10 ++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/tests/Floating_Point_Expression/digitalfilters1.cc b/tests/Floating_Point_Expression/digitalfilters1.cc
index aca0002..b5886ce 100644
--- a/tests/Floating_Point_Expression/digitalfilters1.cc
+++ b/tests/Floating_Point_Expression/digitalfilters1.cc
@@ -983,8 +983,20 @@ BEGIN_MAIN
   DO_TEST_F8(test01);
   DO_TEST_F8(test02);
   DO_TEST_F8(test03);
-  DO_TEST_F32A(test04);
-  DO_TEST_F64(test05);
-  DO_TEST_F64(test06);
+  DO_TEST_F32(test04);
+
+#define COND_float  PPL_CPP_EQ(PPL_CPP_FP_FORMAT(ANALYZER_FP_FORMAT), 1)
+#define COND_double PPL_CPP_EQ(PPL_CPP_FP_FORMAT(ANALYZER_FP_FORMAT), 2)
+#define COND_float_or_double PPL_CPP_OR(COND_float, COND_double)
+#define PPL_CUSTOM_COND_32 \
+  PPL_CPP_AND(PPL_CPP_EQ(PPL_CPP_LOGBITS, 5), COND_float)
+#define PPL_CUSTOM_COND_64 \
+  PPL_CPP_AND(PPL_CPP_EQ(PPL_CPP_LOGBITS, 6), COND_float_or_double)
+#define PPL_CUSTOM_COND \
+  PPL_CPP_OR(COND_F64, PPL_CPP_OR(PPL_CUSTOM_COND_32, PPL_CUSTOM_COND_64))
+
+  COND_DO_TEST(PPL_CUSTOM_COND, test05);
+  COND_DO_TEST(PPL_CUSTOM_COND, test06);
+
   DO_TEST_F64(test07);
 END_MAIN
diff --git a/tests/ppl_test.hh b/tests/ppl_test.hh
index 0bdcf87..525488d 100644
--- a/tests/ppl_test.hh
+++ b/tests/ppl_test.hh
@@ -314,6 +314,16 @@ catch (const std::exception& e) {					\
 #define DO_TEST_F8A_MAY_OVERFLOW_IF_INEXACT(test, shape) \
   COND_DO_TEST_MAY_OVERFLOW_IF_INEXACT(COND_F8A, test, shape)
 
+// Encoding floating point formats.
+#define PPL_CPP_FP_FORMAT_float                1
+#define PPL_CPP_FP_FORMAT_double               2
+#define PPL_CPP_FP_FORMAT_long_double          3
+#define PPL_CPP_FP_FORMAT_float_ieee754_single 4
+#define PPL_CPP_FP_FORMAT_float_ieee754_double 5
+#define PPL_CPP_FP_FORMAT_float_ieee754_quad   6
+#define PPL_CPP_FP_FORMAT_(format) PPL_CPP_FP_FORMAT_ ## format
+#define PPL_CPP_FP_FORMAT(format) PPL_CPP_FP_FORMAT_(format)
+
 
 // Turn s into a string: PPL_TEST_STR(x + y) => "x + y".
 #define PPL_TEST_STR(s) #s




More information about the PPL-devel mailing list