LbsApi/inc/lcfsbucommondefinitions.h
author Maciej Seroka <maciejs@symbian.org>
Thu, 02 Sep 2010 14:07:28 +0100
branchSymbian3
changeset 59 3a0152bda91c
parent 54 a4835904093b
permissions -rw-r--r--
Updated iby file for localisation smoke test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
*
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
*
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
* Contributors:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
*
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
* Description:
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
*
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
*/
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
/**
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
 @file lcfsbucommondefinitions.h
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
 @internalTechnology
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
*/
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
#ifndef _LCF_SBU_COMMON_DEFINITIONS_H_
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
#define _LCF_SBU_COMMON_DEFINITIONS_H_
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
// Constants
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
#define DUMMY_REQUESTOR_TYPE_ACCEPTED1        (CRequestor::ERequestorService)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
#define DUMMY_REQUESTOR_FORMAT_ACCEPTED1      (CRequestor::EFormatApplication)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
#define DUMMY_REQUESTOR_NAME_ACCEPTED1        (_L("TestService"))
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
#define DUMMY_REQUESTOR_TYPE_ACCEPTED2        (CRequestor::ERequestorContact)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
#define DUMMY_REQUESTOR_FORMAT_ACCEPTED2      (CRequestor::EFormatTelephone)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
#define DUMMY_REQUESTOR_NAME_ACCEPTED2        (_L("+123121234567"))
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
const TInt KDefaultTestTimeout = 5*1000*1000;        //5 seconds should be more than enough.
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
//0.00001;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
#define KErrorToleranceValue KMinTReal64    
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
_LIT(KNoClientFault, "Kill");
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
// Other text
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
// Indicate not yet implemented
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
_LIT(KNotImplemented, "Not yet implemented");
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
_LIT(KBadDiagVerifEventNum, "Wrong number of Verification events in Notifier");
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
_LIT(KBadDiagNotifEventNum, "Wrong number of Notification events in Notifier");
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
#define CHECK_EQUAL_(_expected, _actual) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
    ERROR(_expected != _actual, "Equal check failed")
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
#define CHECK(_condition) ERROR(!(_condition), "Check failed")
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
#define CHECK_REAL_EQUAL_TOL(aExpected, aActual, aTolerance) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
    FAIL(Math::IsNaN(aActual) || Math::IsNaN(aExpected), "One or two of compared values is NaN!") \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
    CHECK(Abs(aActual - aExpected) < aTolerance)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
#define CHECK_REAL_EQUAL(aExpected, aActual) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
    CHECK_REAL_EQUAL_TOL(aExpected, aActual, KErrorToleranceValue)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
#define CHECK_PANIC(aCondition) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
    if (!(aCondition)) CheckPanic(__FILE__, __LINE__);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
#define DO_PANIC_TEST_L(aThreadFunction, aExpectedExitCat, aExpectedExitReason, aTimeoutValue) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
    DO_PANIC_TEST_L_PTR(aThreadFunction, aExpectedExitCat, aExpectedExitReason, aTimeoutValue, NULL)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
#define DO_PANIC_TEST_L_PTR(aThreadFunction, aExpectedExitCat, aExpectedExitReason, \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
    aTimeoutValue, aAnyPtr) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
    { \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
    TExitCategoryName exitName = TPtrC(aExpectedExitCat).Left(KMaxExitCategoryName); \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
    DoPanicTestL(aThreadFunction, exitName, aExpectedExitReason, aTimeoutValue, aAnyPtr); \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
// Here are macros for error logging 
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
// Those imply that are called from within of 
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
// TEF class's function (they use (INFO/ERR)PRINTF member)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
//
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
///////////////////////////////////////////////////////
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
// LEAVES with _error_ if _condition_ is true
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
#define FAIL(condition, error)             \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
    if (condition) {                        \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
        errStr.Format(_L("%s (line %d)"), _S(error), __LINE__);    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
        ERR_PRINTF1(errStr);				\
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
		SetTestStepResult(EFail);           \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
// Must be included in the begining of function definitions
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
// in order to use following ("ERROR") macros
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
// (The string buffer needs to be defined once, otherwise,
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
// in case when a lot of errors are checked, stack may be
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
// overflown, and copilation will fail)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
#define DECLARE_ERROR_STR                   TBuf<160> errStr;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
#define DECLARE_MESSAGE_STR                 TBuf<160> message;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
#define DECLARE_ERROR_LOGGING               DECLARE_ERROR_STR   DECLARE_MESSAGE_STR
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
#define START_ERROR_LOGGING                 iErrorCounter = 0;
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
// Logs a message, which is defined as "..." constant
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
#define LOG(msg)                            \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
    {                                       \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
        errStr.Format(_L("%s (line %d)"), _S(msg), __LINE__);    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
        INFO_PRINTF1(errStr);                  \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
#define LOG_DES(msg_des)                    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
    {                                       \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
        errStr.Format(_L("%S (line %d)"), &msg_des, __LINE__);    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
        INFO_PRINTF1(errStr);                  \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
#define LOG_IIF(condition, msg1, msg2)      \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
    if (condition) LOG(msg1) else LOG(msg2)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   134
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   135
// Logs an error, which is defined as "..." constant
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   136
#define ERR(error)                          \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   137
    {                                       \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   138
        errStr.Format(_L("%s (line %d)"), _S(error), __LINE__);    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   139
        ERR_PRINTF1(errStr);             \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   140
        SetTestStepResult(EFail);			\
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   141
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   142
#define ERR_DES(error)                      \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   143
    {                                       \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   144
        errStr.Format(_L("%S (line %d)"), &error, __LINE__);    \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   145
        ERR_PRINTF1(errStr);             \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   146
        SetTestStepResult(EFail);			\
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   147
    }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   148
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   149
// Logs an _error_ if _condition_ is true
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   150
#define ERROR(condition, error)             \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   151
    if (condition) ERR(error)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   152
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   153
// Logs an error, which defined as descriptor
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   154
#define ERROR_DES(condition, error_des)     \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   155
    if (condition) ERR_DES(error_des)
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   156
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   157
#define ERROR_1(condition, msg_fmt_des, param1)  \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   158
    message.Format(msg_fmt_des, param1);        \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   159
    ERROR_DES(condition, message);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   160
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   161
#define ERROR_2(condition, msg_fmt_des, param1, param2)  \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   162
    message.Format(msg_fmt_des, param1, param2);        \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   163
    ERROR_DES(condition, message);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   164
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   165
#define ERROR_3(condition, msg_fmt_des, param1, param2, param3) \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   166
    message.Format(msg_fmt_des, param1, param2, param3);        \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   167
    ERROR_DES(condition, message);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   168
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   169
#define IF_ERROR(error_code, msg)                               \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   170
    { TInt32 _err = error_code;                                 \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   171
    ERROR_2(_err != KErrNone, _L("%s (error=%d)"), _S(msg), _err); }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   172
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   173
#define IF_ERROR_DES(error_code, msg_des)                       \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   174
    { TInt32 _err = error_code;                                 \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   175
    ERROR_2(_err != KErrNone, _L("%S (error=%d)"), &msg_des, _err); }
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   176
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   177
#define CHECK_EQUAL(_actual, _expected, _msg)                     \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   178
    ERROR_3(_actual != _expected, _L("%s (actual=%d, expected=%d)"), _S(_msg), _actual, _expected);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   179
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   180
#define CHECK_EQUAL_DES(_actual, _expected, _msg_des)           \
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   181
    ERROR_3(_actual != _expected, _L("%S (actual=%d, expected=%d)"), &_msg_des, _actual, _expected);
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   182
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   183
a4835904093b Added new LbsApi smoke test
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   184
#endif // _LCF_SBU_COMMON_DEFINITIONS_H_