(AutomatedTests) Ensure warnings are shown as errors
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / dali-test-suite-utils / dali-test-suite-utils.cpp
index f2cf564..fc14c4b 100644 (file)
@@ -19,8 +19,7 @@
 #include "dali-test-suite-utils.h"
 
 // EXTERNAL INCLUDES
-#include <cstdio>
-#include <cstdarg>
+#include <ostream>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-core.h>
@@ -55,22 +54,6 @@ void tet_printf(const char *format, ...)
   va_end(arg);
 }
 
-/**
- * DALI_TEST_CHECK is a wrapper for tet_result.
- * If the condition evaluates to false, then the function & line number is printed.
- * @param[in] The boolean expression to check
- */
-#define DALI_TEST_CHECK(condition)                                                        \
-if ( (condition) )                                                                        \
-{                                                                                         \
-  tet_result(TET_PASS);                                                                   \
-}                                                                                         \
-else                                                                                      \
-{                                                                                         \
-  fprintf(stderr, "%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__);    \
-  tet_result(TET_FAIL);                                                                   \
-}
-
 bool operator==(TimePeriod a, TimePeriod b)
 {
   return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ;
@@ -93,6 +76,21 @@ std::ostream& operator<<( std::ostream& ostream, Degree angle )
   return ostream;
 }
 
+void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location )
+{
+  DALI_TEST_EQUALS< const BaseHandle& >( baseHandle1, baseHandle2, location );
+}
+
+void DALI_TEST_EQUALS( const size_t value1, const unsigned int value2, const char* location )
+{
+  DALI_TEST_EQUALS< unsigned int>( ( unsigned int )( value1 ), value2, location );
+}
+
+void DALI_TEST_EQUALS( const unsigned int value1, const size_t value2, const char* location )
+{
+  DALI_TEST_EQUALS< unsigned int >( value1, ( unsigned int )( value2 ), location );
+}
+
 void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
 {
   const float* m1 = matrix1.AsFloat();
@@ -101,10 +99,13 @@ void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const cha
 
   for (int i=0;i<9;++i)
   {
-    equivalent &= (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i]));
+    if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) )
+    {
+      equivalent = false;
+    }
   }
 
-  if (!equivalent)
+  if( !equivalent )
   {
     fprintf(stderr, "%s, checking\n"
                "(%f, %f, %f)    (%f, %f, %f)\n"
@@ -172,10 +173,10 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char*
   if (!identical)
   {
     fprintf(stderr, "%s, checking\n"
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n"
                "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n", location,
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n"
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n", location,
                m1[0],  m1[1],  m1[2],  m1[3],   m2[0],  m2[1],  m2[2],  m2[3],
                m1[4],  m1[5],  m1[6],  m1[7],   m2[4],  m2[5],  m2[6],  m2[7],
                m1[8],  m1[9], m1[10], m1[11],   m2[8],  m2[9], m2[10], m2[11],
@@ -203,10 +204,10 @@ void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsil
   if (!equivalent)
   {
     fprintf(stderr, "%s, checking\n"
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n"
                "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n"
-               "(%f, %f, %f, %f) == (%f, %f, %f, %f)\n", location,
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n"
+               "(%f, %f, %f, %f)    (%f, %f, %f, %f)\n", location,
                m1[0],  m1[1],  m1[2],  m1[3],   m2[0],  m2[1],  m2[2],  m2[3],
                m1[4],  m1[5],  m1[6],  m1[7],   m2[4],  m2[5],  m2[6],  m2[7],
                m1[8],  m1[9], m1[10], m1[11],   m2[8],  m2[9], m2[10], m2[11],