Standardize line endings in repo (#30112)

use lf by default
old-commit-hash: 205cf12258
laptop
Justin Newberry 2 years ago committed by GitHub
parent 657d11b4a2
commit a0d7f9b2b1
  1. 2
      .gitattributes
  2. 268
      third_party/acados/include/qpOASES_e/Constants.h
  3. 124
      third_party/acados/include/qpOASES_e/ConstraintProduct.h
  4. 442
      third_party/acados/include/qpOASES_e/Indexlist.h
  5. 574
      third_party/acados/include/qpOASES_e/Matrices.h
  6. 306
      third_party/acados/include/qpOASES_e/Options.h
  7. 4738
      third_party/acados/include/qpOASES_e/QProblem.h
  8. 620
      third_party/acados/include/qpOASES_e/Types.h
  9. 158
      third_party/acados/include/qpOASES_e/UnitTesting.h
  10. 124
      third_party/catch2/include/catch2/catch_reporter_automake.hpp
  11. 360
      third_party/catch2/include/catch2/catch_reporter_sonarqube.hpp
  12. 508
      third_party/catch2/include/catch2/catch_reporter_tap.hpp
  13. 438
      third_party/catch2/include/catch2/catch_reporter_teamcity.hpp
  14. 254
      third_party/snpe/include/DlSystem/IOBufferDataTypeMap.hpp

2
.gitattributes vendored

@ -1,3 +1,5 @@
* text=auto
*.dlc filter=lfs diff=lfs merge=lfs -text *.dlc filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text *.onnx filter=lfs diff=lfs merge=lfs -text
selfdrive/car/tests/test_models_segs.txt filter=lfs diff=lfs merge=lfs -text selfdrive/car/tests/test_models_segs.txt filter=lfs diff=lfs merge=lfs -text

@ -1,134 +1,134 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/Constants.h * \file include/qpOASES_e/Constants.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
* *
* Definition of all global constants. * Definition of all global constants.
*/ */
#ifndef QPOASES_CONSTANTS_H #ifndef QPOASES_CONSTANTS_H
#define QPOASES_CONSTANTS_H #define QPOASES_CONSTANTS_H
#include <qpOASES_e/Types.h> #include <qpOASES_e/Types.h>
#ifdef __CODE_GENERATION__ #ifdef __CODE_GENERATION__
#define CONVERTTOSTRINGAUX(x) #x #define CONVERTTOSTRINGAUX(x) #x
#define CONVERTTOSTRING(x) CONVERTTOSTRINGAUX(x) #define CONVERTTOSTRING(x) CONVERTTOSTRINGAUX(x)
#ifndef QPOASES_CUSTOM_INTERFACE #ifndef QPOASES_CUSTOM_INTERFACE
#include "acado_qpoases3_interface.h" #include "acado_qpoases3_interface.h"
#else #else
#include CONVERTTOSTRING(QPOASES_CUSTOM_INTERFACE) #include CONVERTTOSTRING(QPOASES_CUSTOM_INTERFACE)
#endif #endif
#endif #endif
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
#ifndef __EXTERNAL_DIMENSIONS__ #ifndef __EXTERNAL_DIMENSIONS__
/*#define QPOASES_NVMAX 50 /*#define QPOASES_NVMAX 50
#define QPOASES_NCMAX 100*/ #define QPOASES_NCMAX 100*/
#define QPOASES_NVMAX 287 #define QPOASES_NVMAX 287
#define QPOASES_NCMAX 709 #define QPOASES_NCMAX 709
#endif /* __EXTERNAL_DIMENSIONS__ */ #endif /* __EXTERNAL_DIMENSIONS__ */
/** Maximum number of variables within a QP formulation. /** Maximum number of variables within a QP formulation.
* Note: this value has to be positive! */ * Note: this value has to be positive! */
#define NVMAX QPOASES_NVMAX #define NVMAX QPOASES_NVMAX
/** Maximum number of constraints within a QP formulation. /** Maximum number of constraints within a QP formulation.
* Note: this value has to be positive! */ * Note: this value has to be positive! */
#define NCMAX QPOASES_NCMAX #define NCMAX QPOASES_NCMAX
#if ( QPOASES_NVMAX > QPOASES_NCMAX ) #if ( QPOASES_NVMAX > QPOASES_NCMAX )
#define NVCMAX QPOASES_NVMAX #define NVCMAX QPOASES_NVMAX
#else #else
#define NVCMAX QPOASES_NCMAX #define NVCMAX QPOASES_NCMAX
#endif #endif
#if ( QPOASES_NVMAX > QPOASES_NCMAX ) #if ( QPOASES_NVMAX > QPOASES_NCMAX )
#define NVCMIN QPOASES_NCMAX #define NVCMIN QPOASES_NCMAX
#else #else
#define NVCMIN QPOASES_NVMAX #define NVCMIN QPOASES_NVMAX
#endif #endif
/** Maximum number of QPs in a sequence solved by means of the OQP interface. /** Maximum number of QPs in a sequence solved by means of the OQP interface.
* Note: this value has to be positive! */ * Note: this value has to be positive! */
#define NQPMAX 1000 #define NQPMAX 1000
/** Numerical value of machine precision (min eps, s.t. 1+eps > 1). /** Numerical value of machine precision (min eps, s.t. 1+eps > 1).
* Note: this value has to be positive! */ * Note: this value has to be positive! */
#ifndef __CODE_GENERATION__ #ifndef __CODE_GENERATION__
#ifdef __USE_SINGLE_PRECISION__ #ifdef __USE_SINGLE_PRECISION__
static const real_t QPOASES_EPS = 1.193e-07; static const real_t QPOASES_EPS = 1.193e-07;
#else #else
static const real_t QPOASES_EPS = 2.221e-16; static const real_t QPOASES_EPS = 2.221e-16;
#endif /* __USE_SINGLE_PRECISION__ */ #endif /* __USE_SINGLE_PRECISION__ */
#endif /* __CODE_GENERATION__ */ #endif /* __CODE_GENERATION__ */
/** Numerical value of zero (for situations in which it would be /** Numerical value of zero (for situations in which it would be
* unreasonable to compare with 0.0). * unreasonable to compare with 0.0).
* Note: this value has to be positive! */ * Note: this value has to be positive! */
static const real_t QPOASES_ZERO = 1.0e-25; static const real_t QPOASES_ZERO = 1.0e-25;
/** Numerical value of infinity (e.g. for non-existing bounds). /** Numerical value of infinity (e.g. for non-existing bounds).
* Note: this value has to be positive! */ * Note: this value has to be positive! */
static const real_t QPOASES_INFTY = 1.0e20; static const real_t QPOASES_INFTY = 1.0e20;
/** Tolerance to used for isEqual, isZero etc. /** Tolerance to used for isEqual, isZero etc.
* Note: this value has to be positive! */ * Note: this value has to be positive! */
static const real_t QPOASES_TOL = 1.0e-25; static const real_t QPOASES_TOL = 1.0e-25;
/** Maximum number of characters within a string. /** Maximum number of characters within a string.
* Note: this value should be at least 41! */ * Note: this value should be at least 41! */
#define QPOASES_MAX_STRING_LENGTH 160 #define QPOASES_MAX_STRING_LENGTH 160
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_CONSTANTS_H */ #endif /* QPOASES_CONSTANTS_H */
/* /*
* end of file * end of file
*/ */

@ -1,62 +1,62 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/ConstraintProduct.h * \file include/qpOASES_e/ConstraintProduct.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches (thanks to D. Kwame Minde Kufoalor) * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches (thanks to D. Kwame Minde Kufoalor)
* \version 3.1embedded * \version 3.1embedded
* \date 2009-2015 * \date 2009-2015
* *
* Declaration of the ConstraintProduct interface which allows to specify a * Declaration of the ConstraintProduct interface which allows to specify a
* user-defined function for evaluating the constraint product at the * user-defined function for evaluating the constraint product at the
* current iterate to speed-up QP solution in case of a specially structured * current iterate to speed-up QP solution in case of a specially structured
* constraint matrix. * constraint matrix.
*/ */
#ifndef QPOASES_CONSTRAINT_PRODUCT_H #ifndef QPOASES_CONSTRAINT_PRODUCT_H
#define QPOASES_CONSTRAINT_PRODUCT_H #define QPOASES_CONSTRAINT_PRODUCT_H
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
/** /**
* \brief Interface for specifying user-defined evaluations of constraint products. * \brief Interface for specifying user-defined evaluations of constraint products.
* *
* An interface which allows to specify a user-defined function for evaluating the * An interface which allows to specify a user-defined function for evaluating the
* constraint product at the current iterate to speed-up QP solution in case * constraint product at the current iterate to speed-up QP solution in case
* of a specially structured constraint matrix. * of a specially structured constraint matrix.
* *
* \author Hans Joachim Ferreau (thanks to Kwame Minde Kufoalor) * \author Hans Joachim Ferreau (thanks to Kwame Minde Kufoalor)
* \version 3.1embedded * \version 3.1embedded
* \date 2009-2015 * \date 2009-2015
*/ */
typedef int(*ConstraintProduct)( int, const real_t* const, real_t* const ); typedef int(*ConstraintProduct)( int, const real_t* const, real_t* const );
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_CONSTRAINT_PRODUCT_H */ #endif /* QPOASES_CONSTRAINT_PRODUCT_H */

@ -1,221 +1,221 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/Indexlist.h * \file include/qpOASES_e/Indexlist.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
* *
* Declaration of the Indexlist class designed to manage index lists of * Declaration of the Indexlist class designed to manage index lists of
* constraints and bounds within a SubjectTo object. * constraints and bounds within a SubjectTo object.
*/ */
#ifndef QPOASES_INDEXLIST_H #ifndef QPOASES_INDEXLIST_H
#define QPOASES_INDEXLIST_H #define QPOASES_INDEXLIST_H
#include <qpOASES_e/Utils.h> #include <qpOASES_e/Utils.h>
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
/** /**
* \brief Stores and manages index lists. * \brief Stores and manages index lists.
* *
* This class manages index lists of active/inactive bounds/constraints. * This class manages index lists of active/inactive bounds/constraints.
* *
* \author Hans Joachim Ferreau * \author Hans Joachim Ferreau
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
*/ */
typedef struct typedef struct
{ {
int *number; /**< Array to store numbers of constraints or bounds. */ int *number; /**< Array to store numbers of constraints or bounds. */
int *iSort; /**< Index list to sort vector \a number */ int *iSort; /**< Index list to sort vector \a number */
int length; /**< Length of index list. */ int length; /**< Length of index list. */
int first; /**< Physical index of first element. */ int first; /**< Physical index of first element. */
int last; /**< Physical index of last element. */ int last; /**< Physical index of last element. */
int lastusedindex; /**< Physical index of last entry in index list. */ int lastusedindex; /**< Physical index of last entry in index list. */
int physicallength; /**< Physical length of index list. */ int physicallength; /**< Physical length of index list. */
} Indexlist; } Indexlist;
int Indexlist_calculateMemorySize( int n); int Indexlist_calculateMemorySize( int n);
char *Indexlist_assignMemory(int n, Indexlist **mem, void *raw_memory); char *Indexlist_assignMemory(int n, Indexlist **mem, void *raw_memory);
Indexlist *Indexlist_createMemory( int n ); Indexlist *Indexlist_createMemory( int n );
/** Constructor which takes the desired physical length of the index list. */ /** Constructor which takes the desired physical length of the index list. */
void IndexlistCON( Indexlist* _THIS, void IndexlistCON( Indexlist* _THIS,
int n /**< Physical length of index list. */ int n /**< Physical length of index list. */
); );
/** Copies all members from given rhs object. /** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
void IndexlistCPY( Indexlist* FROM, void IndexlistCPY( Indexlist* FROM,
Indexlist* TO Indexlist* TO
); );
/** Initialises index list of desired physical length. /** Initialises index list of desired physical length.
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
RET_INVALID_ARGUMENTS */ RET_INVALID_ARGUMENTS */
returnValue Indexlist_init( Indexlist* _THIS, returnValue Indexlist_init( Indexlist* _THIS,
int n /**< Physical length of index list. */ int n /**< Physical length of index list. */
); );
/** Creates an array of all numbers within the index set in correct order. /** Creates an array of all numbers within the index set in correct order.
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_CORRUPTED */ RET_INDEXLIST_CORRUPTED */
returnValue Indexlist_getNumberArray( Indexlist* _THIS, returnValue Indexlist_getNumberArray( Indexlist* _THIS,
int** const numberarray /**< Output: Array of numbers (NULL on error). */ int** const numberarray /**< Output: Array of numbers (NULL on error). */
); );
/** Creates an array of all numbers within the index set in correct order. /** Creates an array of all numbers within the index set in correct order.
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_CORRUPTED */ RET_INDEXLIST_CORRUPTED */
returnValue Indexlist_getISortArray( Indexlist* _THIS, returnValue Indexlist_getISortArray( Indexlist* _THIS,
int** const iSortArray /**< Output: iSort Array. */ int** const iSortArray /**< Output: iSort Array. */
); );
/** Determines the index within the index list at which a given number is stored. /** Determines the index within the index list at which a given number is stored.
* \return >= 0: Index of given number. \n * \return >= 0: Index of given number. \n
-1: Number not found. */ -1: Number not found. */
int Indexlist_getIndex( Indexlist* _THIS, int Indexlist_getIndex( Indexlist* _THIS,
int givennumber /**< Number whose index shall be determined. */ int givennumber /**< Number whose index shall be determined. */
); );
/** Returns the number stored at a given physical index. /** Returns the number stored at a given physical index.
* \return >= 0: Number stored at given physical index. \n * \return >= 0: Number stored at given physical index. \n
-RET_INDEXLIST_OUTOFBOUNDS */ -RET_INDEXLIST_OUTOFBOUNDS */
static inline int Indexlist_getNumber( Indexlist* _THIS, static inline int Indexlist_getNumber( Indexlist* _THIS,
int physicalindex /**< Physical index of the number to be returned. */ int physicalindex /**< Physical index of the number to be returned. */
); );
/** Returns the current length of the index list. /** Returns the current length of the index list.
* \return Current length of the index list. */ * \return Current length of the index list. */
static inline int Indexlist_getLength( Indexlist* _THIS static inline int Indexlist_getLength( Indexlist* _THIS
); );
/** Returns last number within the index list. /** Returns last number within the index list.
* \return Last number within the index list. */ * \return Last number within the index list. */
static inline int Indexlist_getLastNumber( Indexlist* _THIS static inline int Indexlist_getLastNumber( Indexlist* _THIS
); );
/** Adds number to index list. /** Adds number to index list.
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_MUST_BE_REORDERD \n RET_INDEXLIST_MUST_BE_REORDERD \n
RET_INDEXLIST_EXCEEDS_MAX_LENGTH */ RET_INDEXLIST_EXCEEDS_MAX_LENGTH */
returnValue Indexlist_addNumber( Indexlist* _THIS, returnValue Indexlist_addNumber( Indexlist* _THIS,
int addnumber /**< Number to be added. */ int addnumber /**< Number to be added. */
); );
/** Removes number from index list. /** Removes number from index list.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Indexlist_removeNumber( Indexlist* _THIS, returnValue Indexlist_removeNumber( Indexlist* _THIS,
int removenumber /**< Number to be removed. */ int removenumber /**< Number to be removed. */
); );
/** Swaps two numbers within index list. /** Swaps two numbers within index list.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Indexlist_swapNumbers( Indexlist* _THIS, returnValue Indexlist_swapNumbers( Indexlist* _THIS,
int number1, /**< First number for swapping. */ int number1, /**< First number for swapping. */
int number2 /**< Second number for swapping. */ int number2 /**< Second number for swapping. */
); );
/** Determines if a given number is contained in the index set. /** Determines if a given number is contained in the index set.
* \return BT_TRUE iff number is contain in the index set */ * \return BT_TRUE iff number is contain in the index set */
static inline BooleanType Indexlist_isMember( Indexlist* _THIS, static inline BooleanType Indexlist_isMember( Indexlist* _THIS,
int _number /**< Number to be tested for membership. */ int _number /**< Number to be tested for membership. */
); );
/** Find first index j between -1 and length in sorted list of indices /** Find first index j between -1 and length in sorted list of indices
* iSort such that numbers[iSort[j]] <= i < numbers[iSort[j+1]]. Uses * iSort such that numbers[iSort[j]] <= i < numbers[iSort[j+1]]. Uses
* bisection. * bisection.
* \return j. */ * \return j. */
int Indexlist_findInsert( Indexlist* _THIS, int Indexlist_findInsert( Indexlist* _THIS,
int i int i
); );
/* /*
* g e t N u m b e r * g e t N u m b e r
*/ */
static inline int Indexlist_getNumber( Indexlist* _THIS, int physicalindex ) static inline int Indexlist_getNumber( Indexlist* _THIS, int physicalindex )
{ {
/* consistency check */ /* consistency check */
if ( ( physicalindex < 0 ) || ( physicalindex > _THIS->length ) ) if ( ( physicalindex < 0 ) || ( physicalindex > _THIS->length ) )
return -RET_INDEXLIST_OUTOFBOUNDS; return -RET_INDEXLIST_OUTOFBOUNDS;
return _THIS->number[physicalindex]; return _THIS->number[physicalindex];
} }
/* /*
* g e t L e n g t h * g e t L e n g t h
*/ */
static inline int Indexlist_getLength( Indexlist* _THIS ) static inline int Indexlist_getLength( Indexlist* _THIS )
{ {
return _THIS->length; return _THIS->length;
} }
/* /*
* g e t L a s t N u m b e r * g e t L a s t N u m b e r
*/ */
static inline int Indexlist_getLastNumber( Indexlist* _THIS ) static inline int Indexlist_getLastNumber( Indexlist* _THIS )
{ {
return _THIS->number[_THIS->length-1]; return _THIS->number[_THIS->length-1];
} }
/* /*
* g e t L a s t N u m b e r * g e t L a s t N u m b e r
*/ */
static inline BooleanType Indexlist_isMember( Indexlist* _THIS, int _number ) static inline BooleanType Indexlist_isMember( Indexlist* _THIS, int _number )
{ {
if ( Indexlist_getIndex( _THIS,_number ) >= 0 ) if ( Indexlist_getIndex( _THIS,_number ) >= 0 )
return BT_TRUE; return BT_TRUE;
else else
return BT_FALSE; return BT_FALSE;
} }
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_INDEXLIST_H */ #endif /* QPOASES_INDEXLIST_H */
/* /*
* end of file * end of file
*/ */

@ -1,287 +1,287 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/Matrices.h * \file include/qpOASES_e/Matrices.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2009-2015 * \date 2009-2015
* *
* Various matrix classes: Abstract base matrix class, dense and sparse matrices, * Various matrix classes: Abstract base matrix class, dense and sparse matrices,
* including symmetry exploiting specializations. * including symmetry exploiting specializations.
*/ */
#ifndef QPOASES_MATRICES_H #ifndef QPOASES_MATRICES_H
#define QPOASES_MATRICES_H #define QPOASES_MATRICES_H
#ifdef __USE_SINGLE_PRECISION__ #ifdef __USE_SINGLE_PRECISION__
// single precision // single precision
#define GEMM sgemm_ #define GEMM sgemm_
#define GEMV sgemv_ #define GEMV sgemv_
// #define SYR ssyr_ // #define SYR ssyr_
// #define SYR2 ssyr2_ // #define SYR2 ssyr2_
#define POTRF spotrf_ #define POTRF spotrf_
#else #else
// double precision // double precision
#define GEMM dgemm_ #define GEMM dgemm_
#define GEMV dgemv_ #define GEMV dgemv_
// #define SYR dsyr_ // #define SYR dsyr_
// #define SYR2 dsyr2_ // #define SYR2 dsyr2_
#define POTRF dpotrf_ #define POTRF dpotrf_
#endif /* __USE_SINGLE_PRECISION__ */ #endif /* __USE_SINGLE_PRECISION__ */
#ifdef EXTERNAL_BLAS #ifdef EXTERNAL_BLAS
// double precision // double precision
void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int ldb, double *beta, double *C, int *ldc); void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int ldb, double *beta, double *C, int *ldc);
void dgemv_(char *ta, int *m, int *n, double *alpha, double *A, int *lda, double *x, int *incx, double *beta, double *y, int *incy); void dgemv_(char *ta, int *m, int *n, double *alpha, double *A, int *lda, double *x, int *incx, double *beta, double *y, int *incy);
void dpotrf_(char *uplo, int *m, double *A, int *lda, int *info); void dpotrf_(char *uplo, int *m, double *A, int *lda, int *info);
// single precision // single precision
void sgemm_(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int ldb, float *beta, float *C, int *ldc); void sgemm_(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int ldb, float *beta, float *C, int *ldc);
void sgemv_(char *ta, int *m, int *n, float *alpha, float *A, int *lda, float *x, int *incx, float *beta, float *y, int *incy); void sgemv_(char *ta, int *m, int *n, float *alpha, float *A, int *lda, float *x, int *incx, float *beta, float *y, int *incy);
void spotrf_(char *uplo, int *m, float *A, int *lda, int *info); void spotrf_(char *uplo, int *m, float *A, int *lda, int *info);
#else #else
/** Performs one of the matrix-matrix operation in double precision. */ /** Performs one of the matrix-matrix operation in double precision. */
void dgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*, void dgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*,
const double*, const double*, const unsigned long*, const double*, const unsigned long*, const double*, const double*, const unsigned long*, const double*, const unsigned long*,
const double*, double*, const unsigned long* ); const double*, double*, const unsigned long* );
/** Performs one of the matrix-matrix operation in single precision. */ /** Performs one of the matrix-matrix operation in single precision. */
void sgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*, void sgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*,
const float*, const float*, const unsigned long*, const float*, const unsigned long*, const float*, const float*, const unsigned long*, const float*, const unsigned long*,
const float*, float*, const unsigned long* ); const float*, float*, const unsigned long* );
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in double precision. */ /** Calculates the Cholesky factorization of a real symmetric positive definite matrix in double precision. */
void dpotrf_ ( const char *, const unsigned long *, double *, const unsigned long *, long * ); void dpotrf_ ( const char *, const unsigned long *, double *, const unsigned long *, long * );
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in single precision. */ /** Calculates the Cholesky factorization of a real symmetric positive definite matrix in single precision. */
void spotrf_ ( const char *, const unsigned long *, float *, const unsigned long *, long * ); void spotrf_ ( const char *, const unsigned long *, float *, const unsigned long *, long * );
#endif #endif
/** Performs a symmetric rank 1 operation in double precision. */ /** Performs a symmetric rank 1 operation in double precision. */
// void dsyr_ ( const char *, const unsigned long *, const double *, const double *, // void dsyr_ ( const char *, const unsigned long *, const double *, const double *,
// const unsigned long *, double *, const unsigned long *); // const unsigned long *, double *, const unsigned long *);
/** Performs a symmetric rank 1 operation in single precision. */ /** Performs a symmetric rank 1 operation in single precision. */
// void ssyr_ ( const char *, const unsigned long *, const float *, const float *, // void ssyr_ ( const char *, const unsigned long *, const float *, const float *,
// const unsigned long *, float *, const unsigned long *); // const unsigned long *, float *, const unsigned long *);
/** Performs a symmetric rank 2 operation in double precision. */ /** Performs a symmetric rank 2 operation in double precision. */
// void dsyr2_ ( const char *, const unsigned long *, const double *, const double *, // void dsyr2_ ( const char *, const unsigned long *, const double *, const double *,
// const unsigned long *, const double *, const unsigned long *, double *, const unsigned long *); // const unsigned long *, const double *, const unsigned long *, double *, const unsigned long *);
/** Performs a symmetric rank 2 operation in single precision. */ /** Performs a symmetric rank 2 operation in single precision. */
// void ssyr2_ ( const char *, const unsigned long *, const float *, const float *, // void ssyr2_ ( const char *, const unsigned long *, const float *, const float *,
// const unsigned long *, const float *, const unsigned long *, float *, const unsigned long *); // const unsigned long *, const float *, const unsigned long *, float *, const unsigned long *);
#include <qpOASES_e/Indexlist.h> #include <qpOASES_e/Indexlist.h>
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
/** /**
* \brief Interfaces matrix-vector operations tailored to general dense matrices. * \brief Interfaces matrix-vector operations tailored to general dense matrices.
* *
* Dense matrix class (row major format). * Dense matrix class (row major format).
* *
* \author Andreas Potschka, Christian Kirches, Hans Joachim Ferreau * \author Andreas Potschka, Christian Kirches, Hans Joachim Ferreau
* \version 3.1embedded * \version 3.1embedded
* \date 2011-2015 * \date 2011-2015
*/ */
typedef struct typedef struct
{ {
real_t *val; /**< Vector of entries. */ real_t *val; /**< Vector of entries. */
int nRows; /**< Number of rows. */ int nRows; /**< Number of rows. */
int nCols; /**< Number of columns. */ int nCols; /**< Number of columns. */
int leaDim; /**< Leading dimension. */ int leaDim; /**< Leading dimension. */
} DenseMatrix; } DenseMatrix;
int DenseMatrix_calculateMemorySize( int m, int n ); int DenseMatrix_calculateMemorySize( int m, int n );
char *DenseMatrix_assignMemory( int m, int n, DenseMatrix **mem, void *raw_memory ); char *DenseMatrix_assignMemory( int m, int n, DenseMatrix **mem, void *raw_memory );
DenseMatrix *DenseMatrix_createMemory( int m, int n ); DenseMatrix *DenseMatrix_createMemory( int m, int n );
/** Constructor from vector of values. /** Constructor from vector of values.
* Caution: Data pointer must be valid throughout lifetime * Caution: Data pointer must be valid throughout lifetime
*/ */
void DenseMatrixCON( DenseMatrix* _THIS, void DenseMatrixCON( DenseMatrix* _THIS,
int m, /**< Number of rows. */ int m, /**< Number of rows. */
int n, /**< Number of columns. */ int n, /**< Number of columns. */
int lD, /**< Leading dimension. */ int lD, /**< Leading dimension. */
real_t *v /**< Values. */ real_t *v /**< Values. */
); );
void DenseMatrixCPY( DenseMatrix* FROM, void DenseMatrixCPY( DenseMatrix* FROM,
DenseMatrix* TO DenseMatrix* TO
); );
/** Frees all internal memory. */ /** Frees all internal memory. */
void DenseMatrix_free( DenseMatrix* _THIS ); void DenseMatrix_free( DenseMatrix* _THIS );
/** Constructor from vector of values. /** Constructor from vector of values.
* Caution: Data pointer must be valid throughout lifetime * Caution: Data pointer must be valid throughout lifetime
*/ */
returnValue DenseMatrix_init( DenseMatrix* _THIS, returnValue DenseMatrix_init( DenseMatrix* _THIS,
int m, /**< Number of rows. */ int m, /**< Number of rows. */
int n, /**< Number of columns. */ int n, /**< Number of columns. */
int lD, /**< Leading dimension. */ int lD, /**< Leading dimension. */
real_t *v /**< Values. */ real_t *v /**< Values. */
); );
/** Returns i-th diagonal entry. /** Returns i-th diagonal entry.
* \return i-th diagonal entry */ * \return i-th diagonal entry */
real_t DenseMatrix_diag( DenseMatrix* _THIS, real_t DenseMatrix_diag( DenseMatrix* _THIS,
int i /**< Index. */ int i /**< Index. */
); );
/** Checks whether matrix is square and diagonal. /** Checks whether matrix is square and diagonal.
* \return BT_TRUE iff matrix is square and diagonal; \n * \return BT_TRUE iff matrix is square and diagonal; \n
* BT_FALSE otherwise. */ * BT_FALSE otherwise. */
BooleanType DenseMatrix_isDiag( DenseMatrix* _THIS ); BooleanType DenseMatrix_isDiag( DenseMatrix* _THIS );
/** Get the N-norm of the matrix /** Get the N-norm of the matrix
* \return N-norm of the matrix * \return N-norm of the matrix
*/ */
real_t DenseMatrix_getNorm( DenseMatrix* _THIS, real_t DenseMatrix_getNorm( DenseMatrix* _THIS,
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */ int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
); );
/** Get the N-norm of a row /** Get the N-norm of a row
* \return N-norm of row \a rNum * \return N-norm of row \a rNum
*/ */
real_t DenseMatrix_getRowNorm( DenseMatrix* _THIS, real_t DenseMatrix_getRowNorm( DenseMatrix* _THIS,
int rNum, /**< Row number. */ int rNum, /**< Row number. */
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */ int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
); );
/** Retrieve indexed entries of matrix row multiplied by alpha. /** Retrieve indexed entries of matrix row multiplied by alpha.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_getRow( DenseMatrix* _THIS, returnValue DenseMatrix_getRow( DenseMatrix* _THIS,
int rNum, /**< Row number. */ int rNum, /**< Row number. */
const Indexlist* const icols, /**< Index list specifying columns. */ const Indexlist* const icols, /**< Index list specifying columns. */
real_t alpha, /**< Scalar factor. */ real_t alpha, /**< Scalar factor. */
real_t *row /**< Output row vector. */ real_t *row /**< Output row vector. */
); );
/** Retrieve indexed entries of matrix column multiplied by alpha. /** Retrieve indexed entries of matrix column multiplied by alpha.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_getCol( DenseMatrix* _THIS, returnValue DenseMatrix_getCol( DenseMatrix* _THIS,
int cNum, /**< Column number. */ int cNum, /**< Column number. */
const Indexlist* const irows, /**< Index list specifying rows. */ const Indexlist* const irows, /**< Index list specifying rows. */
real_t alpha, /**< Scalar factor. */ real_t alpha, /**< Scalar factor. */
real_t *col /**< Output column vector. */ real_t *col /**< Output column vector. */
); );
/** Evaluate Y=alpha*A*X + beta*Y. /** Evaluate Y=alpha*A*X + beta*Y.
* \return SUCCESSFUL_RETURN. */ * \return SUCCESSFUL_RETURN. */
returnValue DenseMatrix_times( DenseMatrix* _THIS, returnValue DenseMatrix_times( DenseMatrix* _THIS,
int xN, /**< Number of vectors to multiply. */ int xN, /**< Number of vectors to multiply. */
real_t alpha, /**< Scalar factor for matrix vector product. */ real_t alpha, /**< Scalar factor for matrix vector product. */
const real_t *x, /**< Input vector to be multiplied. */ const real_t *x, /**< Input vector to be multiplied. */
int xLD, /**< Leading dimension of input x. */ int xLD, /**< Leading dimension of input x. */
real_t beta, /**< Scalar factor for y. */ real_t beta, /**< Scalar factor for y. */
real_t *y, /**< Output vector of results. */ real_t *y, /**< Output vector of results. */
int yLD /**< Leading dimension of output y. */ int yLD /**< Leading dimension of output y. */
); );
/** Evaluate Y=alpha*A'*X + beta*Y. /** Evaluate Y=alpha*A'*X + beta*Y.
* \return SUCCESSFUL_RETURN. */ * \return SUCCESSFUL_RETURN. */
returnValue DenseMatrix_transTimes( DenseMatrix* _THIS, returnValue DenseMatrix_transTimes( DenseMatrix* _THIS,
int xN, /**< Number of vectors to multiply. */ int xN, /**< Number of vectors to multiply. */
real_t alpha, /**< Scalar factor for matrix vector product. */ real_t alpha, /**< Scalar factor for matrix vector product. */
const real_t *x, /**< Input vector to be multiplied. */ const real_t *x, /**< Input vector to be multiplied. */
int xLD, /**< Leading dimension of input x. */ int xLD, /**< Leading dimension of input x. */
real_t beta, /**< Scalar factor for y. */ real_t beta, /**< Scalar factor for y. */
real_t *y, /**< Output vector of results. */ real_t *y, /**< Output vector of results. */
int yLD /**< Leading dimension of output y. */ int yLD /**< Leading dimension of output y. */
); );
/** Evaluate matrix vector product with submatrix given by Indexlist. /** Evaluate matrix vector product with submatrix given by Indexlist.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_subTimes( DenseMatrix* _THIS, returnValue DenseMatrix_subTimes( DenseMatrix* _THIS,
const Indexlist* const irows, /**< Index list specifying rows. */ const Indexlist* const irows, /**< Index list specifying rows. */
const Indexlist* const icols, /**< Index list specifying columns. */ const Indexlist* const icols, /**< Index list specifying columns. */
int xN, /**< Number of vectors to multiply. */ int xN, /**< Number of vectors to multiply. */
real_t alpha, /**< Scalar factor for matrix vector product. */ real_t alpha, /**< Scalar factor for matrix vector product. */
const real_t *x, /**< Input vector to be multiplied. */ const real_t *x, /**< Input vector to be multiplied. */
int xLD, /**< Leading dimension of input x. */ int xLD, /**< Leading dimension of input x. */
real_t beta, /**< Scalar factor for y. */ real_t beta, /**< Scalar factor for y. */
real_t *y, /**< Output vector of results. */ real_t *y, /**< Output vector of results. */
int yLD, /**< Leading dimension of output y. */ int yLD, /**< Leading dimension of output y. */
BooleanType yCompr /**< Compressed storage for y. */ BooleanType yCompr /**< Compressed storage for y. */
); );
/** Evaluate matrix transpose vector product. /** Evaluate matrix transpose vector product.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_subTransTimes( DenseMatrix* _THIS, returnValue DenseMatrix_subTransTimes( DenseMatrix* _THIS,
const Indexlist* const irows, /**< Index list specifying rows. */ const Indexlist* const irows, /**< Index list specifying rows. */
const Indexlist* const icols, /**< Index list specifying columns. */ const Indexlist* const icols, /**< Index list specifying columns. */
int xN, /**< Number of vectors to multiply. */ int xN, /**< Number of vectors to multiply. */
real_t alpha, /**< Scalar factor for matrix vector product. */ real_t alpha, /**< Scalar factor for matrix vector product. */
const real_t *x, /**< Input vector to be multiplied. */ const real_t *x, /**< Input vector to be multiplied. */
int xLD, /**< Leading dimension of input x. */ int xLD, /**< Leading dimension of input x. */
real_t beta, /**< Scalar factor for y. */ real_t beta, /**< Scalar factor for y. */
real_t *y, /**< Output vector of results. */ real_t *y, /**< Output vector of results. */
int yLD /**< Leading dimension of output y. */ int yLD /**< Leading dimension of output y. */
); );
/** Adds given offset to diagonal of matrix. /** Adds given offset to diagonal of matrix.
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
RET_NO_DIAGONAL_AVAILABLE */ RET_NO_DIAGONAL_AVAILABLE */
returnValue DenseMatrix_addToDiag( DenseMatrix* _THIS, returnValue DenseMatrix_addToDiag( DenseMatrix* _THIS,
real_t alpha /**< Diagonal offset. */ real_t alpha /**< Diagonal offset. */
); );
/** Prints matrix to screen. /** Prints matrix to screen.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_print( DenseMatrix* _THIS returnValue DenseMatrix_print( DenseMatrix* _THIS
); );
static inline real_t* DenseMatrix_getVal( DenseMatrix* _THIS ) { return _THIS->val; } static inline real_t* DenseMatrix_getVal( DenseMatrix* _THIS ) { return _THIS->val; }
/** Compute bilinear form y = x'*H*x using submatrix given by index list. /** Compute bilinear form y = x'*H*x using submatrix given by index list.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue DenseMatrix_bilinear( DenseMatrix* _THIS, returnValue DenseMatrix_bilinear( DenseMatrix* _THIS,
const Indexlist* const icols, /**< Index list specifying columns of x. */ const Indexlist* const icols, /**< Index list specifying columns of x. */
int xN, /**< Number of vectors to multiply. */ int xN, /**< Number of vectors to multiply. */
const real_t *x, /**< Input vector to be multiplied (uncompressed). */ const real_t *x, /**< Input vector to be multiplied (uncompressed). */
int xLD, /**< Leading dimension of input x. */ int xLD, /**< Leading dimension of input x. */
real_t *y, /**< Output vector of results (compressed). */ real_t *y, /**< Output vector of results (compressed). */
int yLD /**< Leading dimension of output y. */ int yLD /**< Leading dimension of output y. */
); );
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_MATRICES_H */ #endif /* QPOASES_MATRICES_H */

@ -1,153 +1,153 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/Options.h * \file include/qpOASES_e/Options.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
* *
* Declaration of the Options class designed to manage user-specified * Declaration of the Options class designed to manage user-specified
* options for solving a QProblem. * options for solving a QProblem.
*/ */
#ifndef QPOASES_OPTIONS_H #ifndef QPOASES_OPTIONS_H
#define QPOASES_OPTIONS_H #define QPOASES_OPTIONS_H
#include <qpOASES_e/Utils.h> #include <qpOASES_e/Utils.h>
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
/** /**
* \brief Manages all user-specified options for solving QPs. * \brief Manages all user-specified options for solving QPs.
* *
* This class manages all user-specified options used for solving * This class manages all user-specified options used for solving
* quadratic programs. * quadratic programs.
* *
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
*/ */
typedef struct typedef struct
{ {
PrintLevel printLevel; /**< Print level. */ PrintLevel printLevel; /**< Print level. */
BooleanType enableRamping; /**< Specifies whether ramping shall be enabled or not. */ BooleanType enableRamping; /**< Specifies whether ramping shall be enabled or not. */
BooleanType enableFarBounds; /**< Specifies whether far bounds shall be used or not. */ BooleanType enableFarBounds; /**< Specifies whether far bounds shall be used or not. */
BooleanType enableFlippingBounds; /**< Specifies whether flipping bounds shall be used or not. */ BooleanType enableFlippingBounds; /**< Specifies whether flipping bounds shall be used or not. */
BooleanType enableRegularisation; /**< Specifies whether Hessian matrix shall be regularised in case semi-definiteness is detected. */ BooleanType enableRegularisation; /**< Specifies whether Hessian matrix shall be regularised in case semi-definiteness is detected. */
BooleanType enableFullLITests; /**< Specifies whether condition-hardened LI test shall be used or not. */ BooleanType enableFullLITests; /**< Specifies whether condition-hardened LI test shall be used or not. */
BooleanType enableNZCTests; /**< Specifies whether nonzero curvature tests shall be used. */ BooleanType enableNZCTests; /**< Specifies whether nonzero curvature tests shall be used. */
int enableDriftCorrection; /**< Specifies the frequency of drift corrections (0 = off). */ int enableDriftCorrection; /**< Specifies the frequency of drift corrections (0 = off). */
int enableCholeskyRefactorisation; /**< Specifies the frequency of full refactorisation of proj. Hessian (otherwise updates). */ int enableCholeskyRefactorisation; /**< Specifies the frequency of full refactorisation of proj. Hessian (otherwise updates). */
BooleanType enableEqualities; /**< Specifies whether equalities shall be always treated as active constraints. */ BooleanType enableEqualities; /**< Specifies whether equalities shall be always treated as active constraints. */
real_t terminationTolerance; /**< Termination tolerance. */ real_t terminationTolerance; /**< Termination tolerance. */
real_t boundTolerance; /**< Lower/upper (constraints') bound tolerance (an inequality constraint whose lower and upper bounds differ by less is regarded to be an equality constraint). */ real_t boundTolerance; /**< Lower/upper (constraints') bound tolerance (an inequality constraint whose lower and upper bounds differ by less is regarded to be an equality constraint). */
real_t boundRelaxation; /**< Offset for relaxing (constraints') bounds at beginning of an initial homotopy. It is also as initial value for far bounds. */ real_t boundRelaxation; /**< Offset for relaxing (constraints') bounds at beginning of an initial homotopy. It is also as initial value for far bounds. */
real_t epsNum; /**< Numerator tolerance for ratio tests. */ real_t epsNum; /**< Numerator tolerance for ratio tests. */
real_t epsDen; /**< Denominator tolerance for ratio tests. */ real_t epsDen; /**< Denominator tolerance for ratio tests. */
real_t maxPrimalJump; /**< Maximum allowed jump in primal variables in nonzero curvature tests. */ real_t maxPrimalJump; /**< Maximum allowed jump in primal variables in nonzero curvature tests. */
real_t maxDualJump; /**< Maximum allowed jump in dual variables in linear independence tests. */ real_t maxDualJump; /**< Maximum allowed jump in dual variables in linear independence tests. */
real_t initialRamping; /**< Start value for Ramping Strategy. */ real_t initialRamping; /**< Start value for Ramping Strategy. */
real_t finalRamping; /**< Final value for Ramping Strategy. */ real_t finalRamping; /**< Final value for Ramping Strategy. */
real_t initialFarBounds; /**< Initial size of Far Bounds. */ real_t initialFarBounds; /**< Initial size of Far Bounds. */
real_t growFarBounds; /**< Factor to grow Far Bounds. */ real_t growFarBounds; /**< Factor to grow Far Bounds. */
SubjectToStatus initialStatusBounds; /**< Initial status of bounds at first iteration. */ SubjectToStatus initialStatusBounds; /**< Initial status of bounds at first iteration. */
real_t epsFlipping; /**< Tolerance of squared Cholesky diagonal factor which triggers flipping bound. */ real_t epsFlipping; /**< Tolerance of squared Cholesky diagonal factor which triggers flipping bound. */
int numRegularisationSteps; /**< Maximum number of successive regularisation steps. */ int numRegularisationSteps; /**< Maximum number of successive regularisation steps. */
real_t epsRegularisation; /**< Scaling factor of identity matrix used for Hessian regularisation. */ real_t epsRegularisation; /**< Scaling factor of identity matrix used for Hessian regularisation. */
int numRefinementSteps; /**< Maximum number of iterative refinement steps. */ int numRefinementSteps; /**< Maximum number of iterative refinement steps. */
real_t epsIterRef; /**< Early termination tolerance for iterative refinement. */ real_t epsIterRef; /**< Early termination tolerance for iterative refinement. */
real_t epsLITests; /**< Tolerance for linear independence tests. */ real_t epsLITests; /**< Tolerance for linear independence tests. */
real_t epsNZCTests; /**< Tolerance for nonzero curvature tests. */ real_t epsNZCTests; /**< Tolerance for nonzero curvature tests. */
BooleanType enableDropInfeasibles; /**< ... */ BooleanType enableDropInfeasibles; /**< ... */
int dropBoundPriority; /**< ... */ int dropBoundPriority; /**< ... */
int dropEqConPriority; /**< ... */ int dropEqConPriority; /**< ... */
int dropIneqConPriority; /**< ... */ int dropIneqConPriority; /**< ... */
} Options; } Options;
void OptionsCON( Options* _THIS void OptionsCON( Options* _THIS
); );
/** Copies all members from given rhs object. /** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
void OptionsCPY( Options* FROM, void OptionsCPY( Options* FROM,
Options* TO Options* TO
); );
/** Sets all options to default values. /** Sets all options to default values.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Options_setToDefault( Options* _THIS returnValue Options_setToDefault( Options* _THIS
); );
/** Sets all options to values resulting in maximum reliabilty. /** Sets all options to values resulting in maximum reliabilty.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Options_setToReliable( Options* _THIS returnValue Options_setToReliable( Options* _THIS
); );
/** Sets all options to values resulting in minimum solution time. /** Sets all options to values resulting in minimum solution time.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Options_setToMPC( Options* _THIS returnValue Options_setToMPC( Options* _THIS
); );
/** Same as setToMPC( ), for ensuring backwards compatibility. /** Same as setToMPC( ), for ensuring backwards compatibility.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Options_setToFast( Options* _THIS returnValue Options_setToFast( Options* _THIS
); );
/** Ensures that all options have consistent values by automatically /** Ensures that all options have consistent values by automatically
* adjusting inconsistent ones. * adjusting inconsistent ones.
* Note: This routine cannot (and does not try to) ensure that values * Note: This routine cannot (and does not try to) ensure that values
* are set to reasonable values that make the QP solution work! * are set to reasonable values that make the QP solution work!
* \return SUCCESSFUL_RETURN \n * \return SUCCESSFUL_RETURN \n
* RET_OPTIONS_ADJUSTED */ * RET_OPTIONS_ADJUSTED */
returnValue Options_ensureConsistency( Options* _THIS returnValue Options_ensureConsistency( Options* _THIS
); );
/** Prints values of all options. /** Prints values of all options.
* \return SUCCESSFUL_RETURN */ * \return SUCCESSFUL_RETURN */
returnValue Options_print( Options* _THIS returnValue Options_print( Options* _THIS
); );
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_OPTIONS_H */ #endif /* QPOASES_OPTIONS_H */
/* /*
* end of file * end of file
*/ */

File diff suppressed because it is too large Load Diff

@ -1,310 +1,310 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/Types.h * \file include/qpOASES_e/Types.h
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches * \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.1embedded * \version 3.1embedded
* \date 2007-2015 * \date 2007-2015
* *
* Declaration of all non-built-in types (except for classes). * Declaration of all non-built-in types (except for classes).
*/ */
#ifndef QPOASES_TYPES_H #ifndef QPOASES_TYPES_H
#define QPOASES_TYPES_H #define QPOASES_TYPES_H
#ifdef USE_ACADOS_TYPES #ifdef USE_ACADOS_TYPES
#include "acados/utils/types.h" #include "acados/utils/types.h"
#endif #endif
/* If your compiler does not support the snprintf() function, /* If your compiler does not support the snprintf() function,
* uncomment the following line and try to compile again. */ * uncomment the following line and try to compile again. */
/* #define __NO_SNPRINTF__ */ /* #define __NO_SNPRINTF__ */
/* Uncomment the following line for setting the __DSPACE__ flag. */ /* Uncomment the following line for setting the __DSPACE__ flag. */
/* #define __DSPACE__ */ /* #define __DSPACE__ */
/* Uncomment the following line for setting the __XPCTARGET__ flag. */ /* Uncomment the following line for setting the __XPCTARGET__ flag. */
/* #define __XPCTARGET__ */ /* #define __XPCTARGET__ */
/* Uncomment the following line for setting the __NO_FMATH__ flag. */ /* Uncomment the following line for setting the __NO_FMATH__ flag. */
/* #define __NO_FMATH__ */ /* #define __NO_FMATH__ */
/* Uncomment the following line to enable debug information. */ /* Uncomment the following line to enable debug information. */
/* #define __DEBUG__ */ /* #define __DEBUG__ */
/* Uncomment the following line to enable suppress any kind of console output. */ /* Uncomment the following line to enable suppress any kind of console output. */
/* #define __SUPPRESSANYOUTPUT__ */ /* #define __SUPPRESSANYOUTPUT__ */
/** Forces to always include all implicitly fixed bounds and all equality constraints /** Forces to always include all implicitly fixed bounds and all equality constraints
* into the initial working set when setting up an auxiliary QP. */ * into the initial working set when setting up an auxiliary QP. */
#define __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ #define __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__
/* Uncomment the following line to activate the use of an alternative Givens /* Uncomment the following line to activate the use of an alternative Givens
* plane rotation requiring only three multiplications. */ * plane rotation requiring only three multiplications. */
/* #define __USE_THREE_MULTS_GIVENS__ */ /* #define __USE_THREE_MULTS_GIVENS__ */
/* Uncomment the following line to activate the use of single precision arithmetic. */ /* Uncomment the following line to activate the use of single precision arithmetic. */
/* #define __USE_SINGLE_PRECISION__ */ /* #define __USE_SINGLE_PRECISION__ */
/* The inline keyword is skipped by default as it is not part of the C90 standard. /* The inline keyword is skipped by default as it is not part of the C90 standard.
* However, by uncommenting the following line, use of the inline keyword can be enforced. */ * However, by uncommenting the following line, use of the inline keyword can be enforced. */
/* #define __USE_INLINE__ */ /* #define __USE_INLINE__ */
/* Work-around for Borland BCC 5.5 compiler. */ /* Work-around for Borland BCC 5.5 compiler. */
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#if __BORLANDC__ < 0x0561 #if __BORLANDC__ < 0x0561
#define __STDC__ 1 #define __STDC__ 1
#endif #endif
#endif #endif
/* Work-around for Microsoft compilers. */ /* Work-around for Microsoft compilers. */
#ifdef _MSC_VER #ifdef _MSC_VER
#define __NO_SNPRINTF__ #define __NO_SNPRINTF__
#pragma warning( disable : 4061 4100 4250 4514 4996 ) #pragma warning( disable : 4061 4100 4250 4514 4996 )
#endif #endif
/* Apply pre-processor settings when using qpOASES within auto-generated code. */ /* Apply pre-processor settings when using qpOASES within auto-generated code. */
#ifdef __CODE_GENERATION__ #ifdef __CODE_GENERATION__
#define __NO_COPYRIGHT__ #define __NO_COPYRIGHT__
#define __EXTERNAL_DIMENSIONS__ #define __EXTERNAL_DIMENSIONS__
#endif /* __CODE_GENERATION__ */ #endif /* __CODE_GENERATION__ */
/* Avoid using static variables declaration within functions. */ /* Avoid using static variables declaration within functions. */
#ifdef __NO_STATIC__ #ifdef __NO_STATIC__
#define myStatic #define myStatic
#else #else
#define myStatic static #define myStatic static
#endif /* __NO_STATIC__ */ #endif /* __NO_STATIC__ */
/* Skip inline keyword if not specified otherwise. */ /* Skip inline keyword if not specified otherwise. */
#ifndef __USE_INLINE__ #ifndef __USE_INLINE__
#define inline #define inline
#endif #endif
/* Avoid any printing on embedded platforms. */ /* Avoid any printing on embedded platforms. */
#if defined(__DSPACE__) || defined(__XPCTARGET__) #if defined(__DSPACE__) || defined(__XPCTARGET__)
#define __SUPPRESSANYOUTPUT__ #define __SUPPRESSANYOUTPUT__
#define __NO_SNPRINTF__ #define __NO_SNPRINTF__
#endif #endif
#ifdef __NO_SNPRINTF__ #ifdef __NO_SNPRINTF__
#if (!defined(_MSC_VER)) || defined(__DSPACE__) || defined(__XPCTARGET__) #if (!defined(_MSC_VER)) || defined(__DSPACE__) || defined(__XPCTARGET__)
/* If snprintf is not available, provide an empty implementation... */ /* If snprintf is not available, provide an empty implementation... */
int snprintf( char* s, size_t n, const char* format, ... ); int snprintf( char* s, size_t n, const char* format, ... );
#else #else
/* ... or substitute snprintf by _snprintf for Microsoft compilers. */ /* ... or substitute snprintf by _snprintf for Microsoft compilers. */
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#endif /* __NO_SNPRINTF__ */ #endif /* __NO_SNPRINTF__ */
/** Macro for switching on/off the beginning of the qpOASES namespace definition. */ /** Macro for switching on/off the beginning of the qpOASES namespace definition. */
#define BEGIN_NAMESPACE_QPOASES #define BEGIN_NAMESPACE_QPOASES
/** Macro for switching on/off the end of the qpOASES namespace definition. */ /** Macro for switching on/off the end of the qpOASES namespace definition. */
#define END_NAMESPACE_QPOASES #define END_NAMESPACE_QPOASES
/** Macro for switching on/off the use of the qpOASES namespace. */ /** Macro for switching on/off the use of the qpOASES namespace. */
#define USING_NAMESPACE_QPOASES #define USING_NAMESPACE_QPOASES
/** Macro for switching on/off references to the qpOASES namespace. */ /** Macro for switching on/off references to the qpOASES namespace. */
#define REFER_NAMESPACE_QPOASES /*::*/ #define REFER_NAMESPACE_QPOASES /*::*/
/** Macro for accessing the Cholesky factor R. */ /** Macro for accessing the Cholesky factor R. */
#define RR( I,J ) _THIS->R[(I)+nV*(J)] #define RR( I,J ) _THIS->R[(I)+nV*(J)]
/** Macro for accessing the orthonormal matrix Q of the QT factorisation. */ /** Macro for accessing the orthonormal matrix Q of the QT factorisation. */
#define QQ( I,J ) _THIS->Q[(I)+nV*(J)] #define QQ( I,J ) _THIS->Q[(I)+nV*(J)]
/** Macro for accessing the triangular matrix T of the QT factorisation. */ /** Macro for accessing the triangular matrix T of the QT factorisation. */
#define TT( I,J ) _THIS->T[(I)*nVC_min+(J)] #define TT( I,J ) _THIS->T[(I)*nVC_min+(J)]
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
/** Defines real_t for facilitating switching between double and float. */ /** Defines real_t for facilitating switching between double and float. */
#ifndef USE_ACADOS_TYPES #ifndef USE_ACADOS_TYPES
#ifndef __CODE_GENERATION__ #ifndef __CODE_GENERATION__
#ifdef __USE_SINGLE_PRECISION__ #ifdef __USE_SINGLE_PRECISION__
typedef float real_t; typedef float real_t;
#else #else
typedef double real_t; typedef double real_t;
#endif /* __USE_SINGLE_PRECISION__ */ #endif /* __USE_SINGLE_PRECISION__ */
#endif /* __CODE_GENERATION__ */ #endif /* __CODE_GENERATION__ */
#endif /* USE_ACADOS_TYPES */ #endif /* USE_ACADOS_TYPES */
/** Summarises all possible logical values. */ /** Summarises all possible logical values. */
typedef enum typedef enum
{ {
BT_FALSE = 0, /**< Logical value for "false". */ BT_FALSE = 0, /**< Logical value for "false". */
BT_TRUE /**< Logical value for "true". */ BT_TRUE /**< Logical value for "true". */
} BooleanType; } BooleanType;
/** Summarises all possible print levels. Print levels are used to describe /** Summarises all possible print levels. Print levels are used to describe
* the desired amount of output during runtime of qpOASES. */ * the desired amount of output during runtime of qpOASES. */
typedef enum typedef enum
{ {
PL_DEBUG_ITER = -2, /**< Full tabular debugging output. */ PL_DEBUG_ITER = -2, /**< Full tabular debugging output. */
PL_TABULAR, /**< Tabular output. */ PL_TABULAR, /**< Tabular output. */
PL_NONE, /**< No output. */ PL_NONE, /**< No output. */
PL_LOW, /**< Print error messages only. */ PL_LOW, /**< Print error messages only. */
PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */ PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */
PL_HIGH /**< Print all messages with full details. */ PL_HIGH /**< Print all messages with full details. */
} PrintLevel; } PrintLevel;
/** Defines visibility status of a message. */ /** Defines visibility status of a message. */
typedef enum typedef enum
{ {
VS_HIDDEN, /**< Message not visible. */ VS_HIDDEN, /**< Message not visible. */
VS_VISIBLE /**< Message visible. */ VS_VISIBLE /**< Message visible. */
} VisibilityStatus; } VisibilityStatus;
/** Summarises all possible states of the (S)QProblem(B) object during the /** Summarises all possible states of the (S)QProblem(B) object during the
solution process of a QP sequence. */ solution process of a QP sequence. */
typedef enum typedef enum
{ {
QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */ QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */
QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning
* via an initial homotopy or after changing the QP matrices. */ * via an initial homotopy or after changing the QP matrices. */
QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning
* via an initial homotopy or after changing the QP matrices. */ * via an initial homotopy or after changing the QP matrices. */
QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active
* set strategy is performed. */ * set strategy is performed. */
QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */ QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */
QPS_SOLVED /**< The solution of the actual QP was found. */ QPS_SOLVED /**< The solution of the actual QP was found. */
} QProblemStatus; } QProblemStatus;
/** Summarises all possible types of the QP's Hessian matrix. */ /** Summarises all possible types of the QP's Hessian matrix. */
typedef enum typedef enum
{ {
HST_ZERO, /**< Hessian is zero matrix (i.e. LP formulation). */ HST_ZERO, /**< Hessian is zero matrix (i.e. LP formulation). */
HST_IDENTITY, /**< Hessian is identity matrix. */ HST_IDENTITY, /**< Hessian is identity matrix. */
HST_POSDEF, /**< Hessian is (strictly) positive definite. */ HST_POSDEF, /**< Hessian is (strictly) positive definite. */
HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */ HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */
HST_SEMIDEF, /**< Hessian is positive semi-definite. */ HST_SEMIDEF, /**< Hessian is positive semi-definite. */
HST_INDEF, /**< Hessian is indefinite. */ HST_INDEF, /**< Hessian is indefinite. */
HST_UNKNOWN /**< Hessian type is unknown. */ HST_UNKNOWN /**< Hessian type is unknown. */
} HessianType; } HessianType;
/** Summarises all possible types of bounds and constraints. */ /** Summarises all possible types of bounds and constraints. */
typedef enum typedef enum
{ {
ST_UNBOUNDED, /**< Bound/constraint is unbounded. */ ST_UNBOUNDED, /**< Bound/constraint is unbounded. */
ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */ ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */
ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */ ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */
ST_DISABLED, /**< Bound/constraint is disabled (i.e. ignored when solving QP). */ ST_DISABLED, /**< Bound/constraint is disabled (i.e. ignored when solving QP). */
ST_UNKNOWN /**< Type of bound/constraint unknown. */ ST_UNKNOWN /**< Type of bound/constraint unknown. */
} SubjectToType; } SubjectToType;
/** Summarises all possible states of bounds and constraints. */ /** Summarises all possible states of bounds and constraints. */
typedef enum typedef enum
{ {
ST_LOWER = -1, /**< Bound/constraint is at its lower bound. */ ST_LOWER = -1, /**< Bound/constraint is at its lower bound. */
ST_INACTIVE, /**< Bound/constraint is inactive. */ ST_INACTIVE, /**< Bound/constraint is inactive. */
ST_UPPER, /**< Bound/constraint is at its upper bound. */ ST_UPPER, /**< Bound/constraint is at its upper bound. */
ST_INFEASIBLE_LOWER, /**< (to be documented) */ ST_INFEASIBLE_LOWER, /**< (to be documented) */
ST_INFEASIBLE_UPPER, /**< (to be documented) */ ST_INFEASIBLE_UPPER, /**< (to be documented) */
ST_UNDEFINED /**< Status of bound/constraint undefined. */ ST_UNDEFINED /**< Status of bound/constraint undefined. */
} SubjectToStatus; } SubjectToStatus;
/** /**
* \brief Stores internal information for tabular (debugging) output. * \brief Stores internal information for tabular (debugging) output.
* *
* Struct storing internal information for tabular (debugging) output * Struct storing internal information for tabular (debugging) output
* when using the (S)QProblem(B) objects. * when using the (S)QProblem(B) objects.
* *
* \author Hans Joachim Ferreau * \author Hans Joachim Ferreau
* \version 3.1embedded * \version 3.1embedded
* \date 2013-2015 * \date 2013-2015
*/ */
typedef struct typedef struct
{ {
int idxAddB; /**< Index of bound that has been added to working set. */ int idxAddB; /**< Index of bound that has been added to working set. */
int idxRemB; /**< Index of bound that has been removed from working set. */ int idxRemB; /**< Index of bound that has been removed from working set. */
int idxAddC; /**< Index of constraint that has been added to working set. */ int idxAddC; /**< Index of constraint that has been added to working set. */
int idxRemC; /**< Index of constraint that has been removed from working set. */ int idxRemC; /**< Index of constraint that has been removed from working set. */
int excAddB; /**< Flag indicating whether a bound has been added to working set to keep a regular projected Hessian. */ int excAddB; /**< Flag indicating whether a bound has been added to working set to keep a regular projected Hessian. */
int excRemB; /**< Flag indicating whether a bound has been removed from working set to keep a regular projected Hessian. */ int excRemB; /**< Flag indicating whether a bound has been removed from working set to keep a regular projected Hessian. */
int excAddC; /**< Flag indicating whether a constraint has been added to working set to keep a regular projected Hessian. */ int excAddC; /**< Flag indicating whether a constraint has been added to working set to keep a regular projected Hessian. */
int excRemC; /**< Flag indicating whether a constraint has been removed from working set to keep a regular projected Hessian. */ int excRemC; /**< Flag indicating whether a constraint has been removed from working set to keep a regular projected Hessian. */
} TabularOutput; } TabularOutput;
/** /**
* \brief Struct containing the variable header for mat file. * \brief Struct containing the variable header for mat file.
* *
* Struct storing the header of a variable to be stored in * Struct storing the header of a variable to be stored in
* Matlab's binary format (using the outdated Level 4 variant * Matlab's binary format (using the outdated Level 4 variant
* for simplictiy). * for simplictiy).
* *
* Note, this code snippet has been inspired from the document * Note, this code snippet has been inspired from the document
* "Matlab(R) MAT-file Format, R2013b" by MathWorks * "Matlab(R) MAT-file Format, R2013b" by MathWorks
* *
* \author Hans Joachim Ferreau * \author Hans Joachim Ferreau
* \version 3.1embedded * \version 3.1embedded
* \date 2013-2015 * \date 2013-2015
*/ */
typedef struct typedef struct
{ {
long numericFormat; /**< Flag indicating numerical format. */ long numericFormat; /**< Flag indicating numerical format. */
long nRows; /**< Number of rows. */ long nRows; /**< Number of rows. */
long nCols; /**< Number of rows. */ long nCols; /**< Number of rows. */
long imaginaryPart; /**< (to be documented) */ long imaginaryPart; /**< (to be documented) */
long nCharName; /**< Number of character in name. */ long nCharName; /**< Number of character in name. */
} MatMatrixHeader; } MatMatrixHeader;
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_TYPES_H */ #endif /* QPOASES_TYPES_H */
/* /*
* end of file * end of file
*/ */

@ -1,79 +1,79 @@
/* /*
* This file is part of qpOASES. * This file is part of qpOASES.
* *
* qpOASES -- An Implementation of the Online Active Set Strategy. * qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
* Christian Kirches et al. All rights reserved. * Christian Kirches et al. All rights reserved.
* *
* qpOASES is free software; you can redistribute it and/or * qpOASES is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* qpOASES is distributed in the hope that it will be useful, * qpOASES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. * See the GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with qpOASES; if not, write to the Free Software * License along with qpOASES; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/** /**
* \file include/qpOASES_e/UnitTesting.h * \file include/qpOASES_e/UnitTesting.h
* \author Hans Joachim Ferreau * \author Hans Joachim Ferreau
* \version 3.1embedded * \version 3.1embedded
* \date 2014-2015 * \date 2014-2015
* *
* Definition of auxiliary functions/macros for unit testing. * Definition of auxiliary functions/macros for unit testing.
*/ */
#ifndef QPOASES_UNIT_TESTING_H #ifndef QPOASES_UNIT_TESTING_H
#define QPOASES_UNIT_TESTING_H #define QPOASES_UNIT_TESTING_H
#ifndef TEST_TOL_FACTOR #ifndef TEST_TOL_FACTOR
#define TEST_TOL_FACTOR 1 #define TEST_TOL_FACTOR 1
#endif #endif
/** Return value for tests that passed. */ /** Return value for tests that passed. */
#define TEST_PASSED 0 #define TEST_PASSED 0
/** Return value for tests that failed. */ /** Return value for tests that failed. */
#define TEST_FAILED 1 #define TEST_FAILED 1
/** Return value for tests that could not run due to missing external data. */ /** Return value for tests that could not run due to missing external data. */
#define TEST_DATA_NOT_FOUND 99 #define TEST_DATA_NOT_FOUND 99
/** Macro verifying that two numerical values are equal in order to pass unit test. */ /** Macro verifying that two numerical values are equal in order to pass unit test. */
#define QPOASES_TEST_FOR_EQUAL( x,y ) if ( REFER_NAMESPACE_QPOASES isEqual( (x),(y) ) == BT_FALSE ) { return TEST_FAILED; } #define QPOASES_TEST_FOR_EQUAL( x,y ) if ( REFER_NAMESPACE_QPOASES isEqual( (x),(y) ) == BT_FALSE ) { return TEST_FAILED; }
/** Macro verifying that two numerical values are close to each other in order to pass unit test. */ /** Macro verifying that two numerical values are close to each other in order to pass unit test. */
#define QPOASES_TEST_FOR_NEAR( x,y ) if ( REFER_NAMESPACE_QPOASES getAbs((x)-(y)) / REFER_NAMESPACE_QPOASES getMax( 1.0,REFER_NAMESPACE_QPOASES getAbs(x) ) >= 1e-10 ) { return TEST_FAILED; } #define QPOASES_TEST_FOR_NEAR( x,y ) if ( REFER_NAMESPACE_QPOASES getAbs((x)-(y)) / REFER_NAMESPACE_QPOASES getMax( 1.0,REFER_NAMESPACE_QPOASES getAbs(x) ) >= 1e-10 ) { return TEST_FAILED; }
/** Macro verifying that first quantity is lower or equal than second one in order to pass unit test. */ /** Macro verifying that first quantity is lower or equal than second one in order to pass unit test. */
#define QPOASES_TEST_FOR_TOL( x,tol ) if ( (x) > (tol)*(TEST_TOL_FACTOR) ) { return TEST_FAILED; } #define QPOASES_TEST_FOR_TOL( x,tol ) if ( (x) > (tol)*(TEST_TOL_FACTOR) ) { return TEST_FAILED; }
/** Macro verifying that a logical expression holds in order to pass unit test. */ /** Macro verifying that a logical expression holds in order to pass unit test. */
#define QPOASES_TEST_FOR_TRUE( x ) if ( (x) == 0 ) { return TEST_FAILED; } #define QPOASES_TEST_FOR_TRUE( x ) if ( (x) == 0 ) { return TEST_FAILED; }
BEGIN_NAMESPACE_QPOASES BEGIN_NAMESPACE_QPOASES
END_NAMESPACE_QPOASES END_NAMESPACE_QPOASES
#endif /* QPOASES_UNIT_TESTING_H */ #endif /* QPOASES_UNIT_TESTING_H */
/* /*
* end of file * end of file
*/ */

@ -1,62 +1,62 @@
/* /*
* Created by Justin R. Wilson on 2/19/2017. * Created by Justin R. Wilson on 2/19/2017.
* Copyright 2017 Justin R. Wilson. All rights reserved. * Copyright 2017 Justin R. Wilson. All rights reserved.
* *
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
// Don't #include any Catch headers here - we can assume they are already // Don't #include any Catch headers here - we can assume they are already
// included before this header. // included before this header.
// This is not good practice in general but is necessary in this case so this // This is not good practice in general but is necessary in this case so this
// file can be distributed as a single header that works with the main // file can be distributed as a single header that works with the main
// Catch single header. // Catch single header.
namespace Catch { namespace Catch {
struct AutomakeReporter : StreamingReporterBase<AutomakeReporter> { struct AutomakeReporter : StreamingReporterBase<AutomakeReporter> {
AutomakeReporter( ReporterConfig const& _config ) AutomakeReporter( ReporterConfig const& _config )
: StreamingReporterBase( _config ) : StreamingReporterBase( _config )
{} {}
~AutomakeReporter() override; ~AutomakeReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in the format of Automake .trs files"; return "Reports test results in the format of Automake .trs files";
} }
void assertionStarting( AssertionInfo const& ) override {} void assertionStarting( AssertionInfo const& ) override {}
bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; } bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
void testCaseEnded( TestCaseStats const& _testCaseStats ) override { void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
// Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.
stream << ":test-result: "; stream << ":test-result: ";
if (_testCaseStats.totals.assertions.allPassed()) { if (_testCaseStats.totals.assertions.allPassed()) {
stream << "PASS"; stream << "PASS";
} else if (_testCaseStats.totals.assertions.allOk()) { } else if (_testCaseStats.totals.assertions.allOk()) {
stream << "XFAIL"; stream << "XFAIL";
} else { } else {
stream << "FAIL"; stream << "FAIL";
} }
stream << ' ' << _testCaseStats.testInfo.name << '\n'; stream << ' ' << _testCaseStats.testInfo.name << '\n';
StreamingReporterBase::testCaseEnded( _testCaseStats ); StreamingReporterBase::testCaseEnded( _testCaseStats );
} }
void skipTest( TestCaseInfo const& testInfo ) override { void skipTest( TestCaseInfo const& testInfo ) override {
stream << ":test-result: SKIP " << testInfo.name << '\n'; stream << ":test-result: SKIP " << testInfo.name << '\n';
} }
}; };
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
AutomakeReporter::~AutomakeReporter() {} AutomakeReporter::~AutomakeReporter() {}
#endif #endif
CATCH_REGISTER_REPORTER( "automake", AutomakeReporter) CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED

@ -1,181 +1,181 @@
/* /*
* Created by Daniel Garcia on 2018-12-04. * Created by Daniel Garcia on 2018-12-04.
* Copyright Social Point SL. All rights reserved. * Copyright Social Point SL. All rights reserved.
* *
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED #ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED
#define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED #define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED
// Don't #include any Catch headers here - we can assume they are already // Don't #include any Catch headers here - we can assume they are already
// included before this header. // included before this header.
// This is not good practice in general but is necessary in this case so this // This is not good practice in general but is necessary in this case so this
// file can be distributed as a single header that works with the main // file can be distributed as a single header that works with the main
// Catch single header. // Catch single header.
#include <map> #include <map>
namespace Catch { namespace Catch {
struct SonarQubeReporter : CumulativeReporterBase<SonarQubeReporter> { struct SonarQubeReporter : CumulativeReporterBase<SonarQubeReporter> {
SonarQubeReporter(ReporterConfig const& config) SonarQubeReporter(ReporterConfig const& config)
: CumulativeReporterBase(config) : CumulativeReporterBase(config)
, xml(config.stream()) { , xml(config.stream()) {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
m_reporterPrefs.shouldReportAllAssertions = true; m_reporterPrefs.shouldReportAllAssertions = true;
} }
~SonarQubeReporter() override; ~SonarQubeReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in the Generic Test Data SonarQube XML format"; return "Reports test results in the Generic Test Data SonarQube XML format";
} }
static std::set<Verbosity> getSupportedVerbosities() { static std::set<Verbosity> getSupportedVerbosities() {
return { Verbosity::Normal }; return { Verbosity::Normal };
} }
void noMatchingTestCases(std::string const& /*spec*/) override {} void noMatchingTestCases(std::string const& /*spec*/) override {}
void testRunStarting(TestRunInfo const& testRunInfo) override { void testRunStarting(TestRunInfo const& testRunInfo) override {
CumulativeReporterBase::testRunStarting(testRunInfo); CumulativeReporterBase::testRunStarting(testRunInfo);
xml.startElement("testExecutions"); xml.startElement("testExecutions");
xml.writeAttribute("version", "1"); xml.writeAttribute("version", "1");
} }
void testGroupEnded(TestGroupStats const& testGroupStats) override { void testGroupEnded(TestGroupStats const& testGroupStats) override {
CumulativeReporterBase::testGroupEnded(testGroupStats); CumulativeReporterBase::testGroupEnded(testGroupStats);
writeGroup(*m_testGroups.back()); writeGroup(*m_testGroups.back());
} }
void testRunEndedCumulative() override { void testRunEndedCumulative() override {
xml.endElement(); xml.endElement();
} }
void writeGroup(TestGroupNode const& groupNode) { void writeGroup(TestGroupNode const& groupNode) {
std::map<std::string, TestGroupNode::ChildNodes> testsPerFile; std::map<std::string, TestGroupNode::ChildNodes> testsPerFile;
for(auto const& child : groupNode.children) for(auto const& child : groupNode.children)
testsPerFile[child->value.testInfo.lineInfo.file].push_back(child); testsPerFile[child->value.testInfo.lineInfo.file].push_back(child);
for(auto const& kv : testsPerFile) for(auto const& kv : testsPerFile)
writeTestFile(kv.first.c_str(), kv.second); writeTestFile(kv.first.c_str(), kv.second);
} }
void writeTestFile(const char* filename, TestGroupNode::ChildNodes const& testCaseNodes) { void writeTestFile(const char* filename, TestGroupNode::ChildNodes const& testCaseNodes) {
XmlWriter::ScopedElement e = xml.scopedElement("file"); XmlWriter::ScopedElement e = xml.scopedElement("file");
xml.writeAttribute("path", filename); xml.writeAttribute("path", filename);
for(auto const& child : testCaseNodes) for(auto const& child : testCaseNodes)
writeTestCase(*child); writeTestCase(*child);
} }
void writeTestCase(TestCaseNode const& testCaseNode) { void writeTestCase(TestCaseNode const& testCaseNode) {
// All test cases have exactly one section - which represents the // All test cases have exactly one section - which represents the
// test case itself. That section may have 0-n nested sections // test case itself. That section may have 0-n nested sections
assert(testCaseNode.children.size() == 1); assert(testCaseNode.children.size() == 1);
SectionNode const& rootSection = *testCaseNode.children.front(); SectionNode const& rootSection = *testCaseNode.children.front();
writeSection("", rootSection, testCaseNode.value.testInfo.okToFail()); writeSection("", rootSection, testCaseNode.value.testInfo.okToFail());
} }
void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) { void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) {
std::string name = trim(sectionNode.stats.sectionInfo.name); std::string name = trim(sectionNode.stats.sectionInfo.name);
if(!rootName.empty()) if(!rootName.empty())
name = rootName + '/' + name; name = rootName + '/' + name;
if(!sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty()) { if(!sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty()) {
XmlWriter::ScopedElement e = xml.scopedElement("testCase"); XmlWriter::ScopedElement e = xml.scopedElement("testCase");
xml.writeAttribute("name", name); xml.writeAttribute("name", name);
xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000));
writeAssertions(sectionNode, okToFail); writeAssertions(sectionNode, okToFail);
} }
for(auto const& childNode : sectionNode.childSections) for(auto const& childNode : sectionNode.childSections)
writeSection(name, *childNode, okToFail); writeSection(name, *childNode, okToFail);
} }
void writeAssertions(SectionNode const& sectionNode, bool okToFail) { void writeAssertions(SectionNode const& sectionNode, bool okToFail) {
for(auto const& assertion : sectionNode.assertions) for(auto const& assertion : sectionNode.assertions)
writeAssertion( assertion, okToFail); writeAssertion( assertion, okToFail);
} }
void writeAssertion(AssertionStats const& stats, bool okToFail) { void writeAssertion(AssertionStats const& stats, bool okToFail) {
AssertionResult const& result = stats.assertionResult; AssertionResult const& result = stats.assertionResult;
if(!result.isOk()) { if(!result.isOk()) {
std::string elementName; std::string elementName;
if(okToFail) { if(okToFail) {
elementName = "skipped"; elementName = "skipped";
} }
else { else {
switch(result.getResultType()) { switch(result.getResultType()) {
case ResultWas::ThrewException: case ResultWas::ThrewException:
case ResultWas::FatalErrorCondition: case ResultWas::FatalErrorCondition:
elementName = "error"; elementName = "error";
break; break;
case ResultWas::ExplicitFailure: case ResultWas::ExplicitFailure:
elementName = "failure"; elementName = "failure";
break; break;
case ResultWas::ExpressionFailed: case ResultWas::ExpressionFailed:
elementName = "failure"; elementName = "failure";
break; break;
case ResultWas::DidntThrowException: case ResultWas::DidntThrowException:
elementName = "failure"; elementName = "failure";
break; break;
// We should never see these here: // We should never see these here:
case ResultWas::Info: case ResultWas::Info:
case ResultWas::Warning: case ResultWas::Warning:
case ResultWas::Ok: case ResultWas::Ok:
case ResultWas::Unknown: case ResultWas::Unknown:
case ResultWas::FailureBit: case ResultWas::FailureBit:
case ResultWas::Exception: case ResultWas::Exception:
elementName = "internalError"; elementName = "internalError";
break; break;
} }
} }
XmlWriter::ScopedElement e = xml.scopedElement(elementName); XmlWriter::ScopedElement e = xml.scopedElement(elementName);
ReusableStringStream messageRss; ReusableStringStream messageRss;
messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")";
xml.writeAttribute("message", messageRss.str()); xml.writeAttribute("message", messageRss.str());
ReusableStringStream textRss; ReusableStringStream textRss;
if (stats.totals.assertions.total() > 0) { if (stats.totals.assertions.total() > 0) {
textRss << "FAILED:\n"; textRss << "FAILED:\n";
if (result.hasExpression()) { if (result.hasExpression()) {
textRss << "\t" << result.getExpressionInMacro() << "\n"; textRss << "\t" << result.getExpressionInMacro() << "\n";
} }
if (result.hasExpandedExpression()) { if (result.hasExpandedExpression()) {
textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n";
} }
} }
if(!result.getMessage().empty()) if(!result.getMessage().empty())
textRss << result.getMessage() << "\n"; textRss << result.getMessage() << "\n";
for(auto const& msg : stats.infoMessages) for(auto const& msg : stats.infoMessages)
if(msg.type == ResultWas::Info) if(msg.type == ResultWas::Info)
textRss << msg.message << "\n"; textRss << msg.message << "\n";
textRss << "at " << result.getSourceInfo(); textRss << "at " << result.getSourceInfo();
xml.writeText(textRss.str(), XmlFormatting::Newline); xml.writeText(textRss.str(), XmlFormatting::Newline);
} }
} }
private: private:
XmlWriter xml; XmlWriter xml;
}; };
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
SonarQubeReporter::~SonarQubeReporter() {} SonarQubeReporter::~SonarQubeReporter() {}
#endif #endif
CATCH_REGISTER_REPORTER( "sonarqube", SonarQubeReporter ) CATCH_REGISTER_REPORTER( "sonarqube", SonarQubeReporter )
} // end namespace Catch } // end namespace Catch
#endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED #endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED

@ -1,254 +1,254 @@
/* /*
* Created by Colton Wolkins on 2015-08-15. * Created by Colton Wolkins on 2015-08-15.
* Copyright 2015 Martin Moene. All rights reserved. * Copyright 2015 Martin Moene. All rights reserved.
* *
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
// Don't #include any Catch headers here - we can assume they are already // Don't #include any Catch headers here - we can assume they are already
// included before this header. // included before this header.
// This is not good practice in general but is necessary in this case so this // This is not good practice in general but is necessary in this case so this
// file can be distributed as a single header that works with the main // file can be distributed as a single header that works with the main
// Catch single header. // Catch single header.
#include <algorithm> #include <algorithm>
namespace Catch { namespace Catch {
struct TAPReporter : StreamingReporterBase<TAPReporter> { struct TAPReporter : StreamingReporterBase<TAPReporter> {
using StreamingReporterBase::StreamingReporterBase; using StreamingReporterBase::StreamingReporterBase;
TAPReporter( ReporterConfig const& config ): TAPReporter( ReporterConfig const& config ):
StreamingReporterBase( config ) { StreamingReporterBase( config ) {
m_reporterPrefs.shouldReportAllAssertions = true; m_reporterPrefs.shouldReportAllAssertions = true;
} }
~TAPReporter() override; ~TAPReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harnesses"; return "Reports test results in TAP format, suitable for test harnesses";
} }
void noMatchingTestCases( std::string const& spec ) override { void noMatchingTestCases( std::string const& spec ) override {
stream << "# No test cases matched '" << spec << "'" << std::endl; stream << "# No test cases matched '" << spec << "'" << std::endl;
} }
void assertionStarting( AssertionInfo const& ) override {} void assertionStarting( AssertionInfo const& ) override {}
bool assertionEnded( AssertionStats const& _assertionStats ) override { bool assertionEnded( AssertionStats const& _assertionStats ) override {
++counter; ++counter;
stream << "# " << currentTestCaseInfo->name << std::endl; stream << "# " << currentTestCaseInfo->name << std::endl;
AssertionPrinter printer( stream, _assertionStats, counter ); AssertionPrinter printer( stream, _assertionStats, counter );
printer.print(); printer.print();
stream << std::endl; stream << std::endl;
return true; return true;
} }
void testRunEnded( TestRunStats const& _testRunStats ) override { void testRunEnded( TestRunStats const& _testRunStats ) override {
printTotals( _testRunStats.totals ); printTotals( _testRunStats.totals );
stream << "\n" << std::endl; stream << "\n" << std::endl;
StreamingReporterBase::testRunEnded( _testRunStats ); StreamingReporterBase::testRunEnded( _testRunStats );
} }
private: private:
std::size_t counter = 0; std::size_t counter = 0;
class AssertionPrinter { class AssertionPrinter {
public: public:
AssertionPrinter& operator= ( AssertionPrinter const& ) = delete; AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
AssertionPrinter( AssertionPrinter const& ) = delete; AssertionPrinter( AssertionPrinter const& ) = delete;
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter ) AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter )
: stream( _stream ) : stream( _stream )
, result( _stats.assertionResult ) , result( _stats.assertionResult )
, messages( _stats.infoMessages ) , messages( _stats.infoMessages )
, itMessage( _stats.infoMessages.begin() ) , itMessage( _stats.infoMessages.begin() )
, printInfoMessages( true ) , printInfoMessages( true )
, counter(_counter) , counter(_counter)
{} {}
void print() { void print() {
itMessage = messages.begin(); itMessage = messages.begin();
switch( result.getResultType() ) { switch( result.getResultType() ) {
case ResultWas::Ok: case ResultWas::Ok:
printResultType( passedString() ); printResultType( passedString() );
printOriginalExpression(); printOriginalExpression();
printReconstructedExpression(); printReconstructedExpression();
if ( ! result.hasExpression() ) if ( ! result.hasExpression() )
printRemainingMessages( Colour::None ); printRemainingMessages( Colour::None );
else else
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::ExpressionFailed: case ResultWas::ExpressionFailed:
if (result.isOk()) { if (result.isOk()) {
printResultType(passedString()); printResultType(passedString());
} else { } else {
printResultType(failedString()); printResultType(failedString());
} }
printOriginalExpression(); printOriginalExpression();
printReconstructedExpression(); printReconstructedExpression();
if (result.isOk()) { if (result.isOk()) {
printIssue(" # TODO"); printIssue(" # TODO");
} }
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::ThrewException: case ResultWas::ThrewException:
printResultType( failedString() ); printResultType( failedString() );
printIssue( "unexpected exception with message:" ); printIssue( "unexpected exception with message:" );
printMessage(); printMessage();
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::FatalErrorCondition: case ResultWas::FatalErrorCondition:
printResultType( failedString() ); printResultType( failedString() );
printIssue( "fatal error condition with message:" ); printIssue( "fatal error condition with message:" );
printMessage(); printMessage();
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::DidntThrowException: case ResultWas::DidntThrowException:
printResultType( failedString() ); printResultType( failedString() );
printIssue( "expected exception, got none" ); printIssue( "expected exception, got none" );
printExpressionWas(); printExpressionWas();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::Info: case ResultWas::Info:
printResultType( "info" ); printResultType( "info" );
printMessage(); printMessage();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::Warning: case ResultWas::Warning:
printResultType( "warning" ); printResultType( "warning" );
printMessage(); printMessage();
printRemainingMessages(); printRemainingMessages();
break; break;
case ResultWas::ExplicitFailure: case ResultWas::ExplicitFailure:
printResultType( failedString() ); printResultType( failedString() );
printIssue( "explicitly" ); printIssue( "explicitly" );
printRemainingMessages( Colour::None ); printRemainingMessages( Colour::None );
break; break;
// These cases are here to prevent compiler warnings // These cases are here to prevent compiler warnings
case ResultWas::Unknown: case ResultWas::Unknown:
case ResultWas::FailureBit: case ResultWas::FailureBit:
case ResultWas::Exception: case ResultWas::Exception:
printResultType( "** internal error **" ); printResultType( "** internal error **" );
break; break;
} }
} }
private: private:
static Colour::Code dimColour() { return Colour::FileName; } static Colour::Code dimColour() { return Colour::FileName; }
static const char* failedString() { return "not ok"; } static const char* failedString() { return "not ok"; }
static const char* passedString() { return "ok"; } static const char* passedString() { return "ok"; }
void printSourceInfo() const { void printSourceInfo() const {
Colour colourGuard( dimColour() ); Colour colourGuard( dimColour() );
stream << result.getSourceInfo() << ":"; stream << result.getSourceInfo() << ":";
} }
void printResultType( std::string const& passOrFail ) const { void printResultType( std::string const& passOrFail ) const {
if( !passOrFail.empty() ) { if( !passOrFail.empty() ) {
stream << passOrFail << ' ' << counter << " -"; stream << passOrFail << ' ' << counter << " -";
} }
} }
void printIssue( std::string const& issue ) const { void printIssue( std::string const& issue ) const {
stream << " " << issue; stream << " " << issue;
} }
void printExpressionWas() { void printExpressionWas() {
if( result.hasExpression() ) { if( result.hasExpression() ) {
stream << ";"; stream << ";";
{ {
Colour colour( dimColour() ); Colour colour( dimColour() );
stream << " expression was:"; stream << " expression was:";
} }
printOriginalExpression(); printOriginalExpression();
} }
} }
void printOriginalExpression() const { void printOriginalExpression() const {
if( result.hasExpression() ) { if( result.hasExpression() ) {
stream << " " << result.getExpression(); stream << " " << result.getExpression();
} }
} }
void printReconstructedExpression() const { void printReconstructedExpression() const {
if( result.hasExpandedExpression() ) { if( result.hasExpandedExpression() ) {
{ {
Colour colour( dimColour() ); Colour colour( dimColour() );
stream << " for: "; stream << " for: ";
} }
std::string expr = result.getExpandedExpression(); std::string expr = result.getExpandedExpression();
std::replace( expr.begin(), expr.end(), '\n', ' '); std::replace( expr.begin(), expr.end(), '\n', ' ');
stream << expr; stream << expr;
} }
} }
void printMessage() { void printMessage() {
if ( itMessage != messages.end() ) { if ( itMessage != messages.end() ) {
stream << " '" << itMessage->message << "'"; stream << " '" << itMessage->message << "'";
++itMessage; ++itMessage;
} }
} }
void printRemainingMessages( Colour::Code colour = dimColour() ) { void printRemainingMessages( Colour::Code colour = dimColour() ) {
if (itMessage == messages.end()) { if (itMessage == messages.end()) {
return; return;
} }
const auto itEnd = messages.cend(); const auto itEnd = messages.cend();
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) ); const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
{ {
Colour colourGuard( colour ); Colour colourGuard( colour );
stream << " with " << pluralise( N, "message" ) << ":"; stream << " with " << pluralise( N, "message" ) << ":";
} }
while( itMessage != itEnd ) { while( itMessage != itEnd ) {
// If this assertion is a warning ignore any INFO messages // If this assertion is a warning ignore any INFO messages
if( printInfoMessages || itMessage->type != ResultWas::Info ) { if( printInfoMessages || itMessage->type != ResultWas::Info ) {
stream << " '" << itMessage->message << "'"; stream << " '" << itMessage->message << "'";
if ( ++itMessage != itEnd ) { if ( ++itMessage != itEnd ) {
Colour colourGuard( dimColour() ); Colour colourGuard( dimColour() );
stream << " and"; stream << " and";
} }
continue; continue;
} }
++itMessage; ++itMessage;
} }
} }
private: private:
std::ostream& stream; std::ostream& stream;
AssertionResult const& result; AssertionResult const& result;
std::vector<MessageInfo> messages; std::vector<MessageInfo> messages;
std::vector<MessageInfo>::const_iterator itMessage; std::vector<MessageInfo>::const_iterator itMessage;
bool printInfoMessages; bool printInfoMessages;
std::size_t counter; std::size_t counter;
}; };
void printTotals( const Totals& totals ) const { void printTotals( const Totals& totals ) const {
stream << "1.." << totals.assertions.total(); stream << "1.." << totals.assertions.total();
if( totals.testCases.total() == 0 ) { if( totals.testCases.total() == 0 ) {
stream << " # Skipped: No tests ran."; stream << " # Skipped: No tests ran.";
} }
} }
}; };
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
TAPReporter::~TAPReporter() {} TAPReporter::~TAPReporter() {}
#endif #endif
CATCH_REGISTER_REPORTER( "tap", TAPReporter ) CATCH_REGISTER_REPORTER( "tap", TAPReporter )
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED

@ -1,219 +1,219 @@
/* /*
* Created by Phil Nash on 19th December 2014 * Created by Phil Nash on 19th December 2014
* Copyright 2014 Two Blue Cubes Ltd. All rights reserved. * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
* *
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
// Don't #include any Catch headers here - we can assume they are already // Don't #include any Catch headers here - we can assume they are already
// included before this header. // included before this header.
// This is not good practice in general but is necessary in this case so this // This is not good practice in general but is necessary in this case so this
// file can be distributed as a single header that works with the main // file can be distributed as a single header that works with the main
// Catch single header. // Catch single header.
#include <cstring> #include <cstring>
#ifdef __clang__ #ifdef __clang__
# pragma clang diagnostic push # pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wpadded" # pragma clang diagnostic ignored "-Wpadded"
#endif #endif
namespace Catch { namespace Catch {
struct TeamCityReporter : StreamingReporterBase<TeamCityReporter> { struct TeamCityReporter : StreamingReporterBase<TeamCityReporter> {
TeamCityReporter( ReporterConfig const& _config ) TeamCityReporter( ReporterConfig const& _config )
: StreamingReporterBase( _config ) : StreamingReporterBase( _config )
{ {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
static std::string escape( std::string const& str ) { static std::string escape( std::string const& str ) {
std::string escaped = str; std::string escaped = str;
replaceInPlace( escaped, "|", "||" ); replaceInPlace( escaped, "|", "||" );
replaceInPlace( escaped, "'", "|'" ); replaceInPlace( escaped, "'", "|'" );
replaceInPlace( escaped, "\n", "|n" ); replaceInPlace( escaped, "\n", "|n" );
replaceInPlace( escaped, "\r", "|r" ); replaceInPlace( escaped, "\r", "|r" );
replaceInPlace( escaped, "[", "|[" ); replaceInPlace( escaped, "[", "|[" );
replaceInPlace( escaped, "]", "|]" ); replaceInPlace( escaped, "]", "|]" );
return escaped; return escaped;
} }
~TeamCityReporter() override; ~TeamCityReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as TeamCity service messages"; return "Reports test results as TeamCity service messages";
} }
void skipTest( TestCaseInfo const& /* testInfo */ ) override { void skipTest( TestCaseInfo const& /* testInfo */ ) override {
} }
void noMatchingTestCases( std::string const& /* spec */ ) override {} void noMatchingTestCases( std::string const& /* spec */ ) override {}
void testGroupStarting( GroupInfo const& groupInfo ) override { void testGroupStarting( GroupInfo const& groupInfo ) override {
StreamingReporterBase::testGroupStarting( groupInfo ); StreamingReporterBase::testGroupStarting( groupInfo );
stream << "##teamcity[testSuiteStarted name='" stream << "##teamcity[testSuiteStarted name='"
<< escape( groupInfo.name ) << "']\n"; << escape( groupInfo.name ) << "']\n";
} }
void testGroupEnded( TestGroupStats const& testGroupStats ) override { void testGroupEnded( TestGroupStats const& testGroupStats ) override {
StreamingReporterBase::testGroupEnded( testGroupStats ); StreamingReporterBase::testGroupEnded( testGroupStats );
stream << "##teamcity[testSuiteFinished name='" stream << "##teamcity[testSuiteFinished name='"
<< escape( testGroupStats.groupInfo.name ) << "']\n"; << escape( testGroupStats.groupInfo.name ) << "']\n";
} }
void assertionStarting( AssertionInfo const& ) override {} void assertionStarting( AssertionInfo const& ) override {}
bool assertionEnded( AssertionStats const& assertionStats ) override { bool assertionEnded( AssertionStats const& assertionStats ) override {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
if( !result.isOk() ) { if( !result.isOk() ) {
ReusableStringStream msg; ReusableStringStream msg;
if( !m_headerPrintedForThisSection ) if( !m_headerPrintedForThisSection )
printSectionHeader( msg.get() ); printSectionHeader( msg.get() );
m_headerPrintedForThisSection = true; m_headerPrintedForThisSection = true;
msg << result.getSourceInfo() << "\n"; msg << result.getSourceInfo() << "\n";
switch( result.getResultType() ) { switch( result.getResultType() ) {
case ResultWas::ExpressionFailed: case ResultWas::ExpressionFailed:
msg << "expression failed"; msg << "expression failed";
break; break;
case ResultWas::ThrewException: case ResultWas::ThrewException:
msg << "unexpected exception"; msg << "unexpected exception";
break; break;
case ResultWas::FatalErrorCondition: case ResultWas::FatalErrorCondition:
msg << "fatal error condition"; msg << "fatal error condition";
break; break;
case ResultWas::DidntThrowException: case ResultWas::DidntThrowException:
msg << "no exception was thrown where one was expected"; msg << "no exception was thrown where one was expected";
break; break;
case ResultWas::ExplicitFailure: case ResultWas::ExplicitFailure:
msg << "explicit failure"; msg << "explicit failure";
break; break;
// We shouldn't get here because of the isOk() test // We shouldn't get here because of the isOk() test
case ResultWas::Ok: case ResultWas::Ok:
case ResultWas::Info: case ResultWas::Info:
case ResultWas::Warning: case ResultWas::Warning:
CATCH_ERROR( "Internal error in TeamCity reporter" ); CATCH_ERROR( "Internal error in TeamCity reporter" );
// These cases are here to prevent compiler warnings // These cases are here to prevent compiler warnings
case ResultWas::Unknown: case ResultWas::Unknown:
case ResultWas::FailureBit: case ResultWas::FailureBit:
case ResultWas::Exception: case ResultWas::Exception:
CATCH_ERROR( "Not implemented" ); CATCH_ERROR( "Not implemented" );
} }
if( assertionStats.infoMessages.size() == 1 ) if( assertionStats.infoMessages.size() == 1 )
msg << " with message:"; msg << " with message:";
if( assertionStats.infoMessages.size() > 1 ) if( assertionStats.infoMessages.size() > 1 )
msg << " with messages:"; msg << " with messages:";
for( auto const& messageInfo : assertionStats.infoMessages ) for( auto const& messageInfo : assertionStats.infoMessages )
msg << "\n \"" << messageInfo.message << "\""; msg << "\n \"" << messageInfo.message << "\"";
if( result.hasExpression() ) { if( result.hasExpression() ) {
msg << msg <<
"\n " << result.getExpressionInMacro() << "\n" "\n " << result.getExpressionInMacro() << "\n"
"with expansion:\n" << "with expansion:\n" <<
" " << result.getExpandedExpression() << "\n"; " " << result.getExpandedExpression() << "\n";
} }
if( currentTestCaseInfo->okToFail() ) { if( currentTestCaseInfo->okToFail() ) {
msg << "- failure ignore as test marked as 'ok to fail'\n"; msg << "- failure ignore as test marked as 'ok to fail'\n";
stream << "##teamcity[testIgnored" stream << "##teamcity[testIgnored"
<< " name='" << escape( currentTestCaseInfo->name )<< "'" << " name='" << escape( currentTestCaseInfo->name )<< "'"
<< " message='" << escape( msg.str() ) << "'" << " message='" << escape( msg.str() ) << "'"
<< "]\n"; << "]\n";
} }
else { else {
stream << "##teamcity[testFailed" stream << "##teamcity[testFailed"
<< " name='" << escape( currentTestCaseInfo->name )<< "'" << " name='" << escape( currentTestCaseInfo->name )<< "'"
<< " message='" << escape( msg.str() ) << "'" << " message='" << escape( msg.str() ) << "'"
<< "]\n"; << "]\n";
} }
} }
stream.flush(); stream.flush();
return true; return true;
} }
void sectionStarting( SectionInfo const& sectionInfo ) override { void sectionStarting( SectionInfo const& sectionInfo ) override {
m_headerPrintedForThisSection = false; m_headerPrintedForThisSection = false;
StreamingReporterBase::sectionStarting( sectionInfo ); StreamingReporterBase::sectionStarting( sectionInfo );
} }
void testCaseStarting( TestCaseInfo const& testInfo ) override { void testCaseStarting( TestCaseInfo const& testInfo ) override {
m_testTimer.start(); m_testTimer.start();
StreamingReporterBase::testCaseStarting( testInfo ); StreamingReporterBase::testCaseStarting( testInfo );
stream << "##teamcity[testStarted name='" stream << "##teamcity[testStarted name='"
<< escape( testInfo.name ) << "']\n"; << escape( testInfo.name ) << "']\n";
stream.flush(); stream.flush();
} }
void testCaseEnded( TestCaseStats const& testCaseStats ) override { void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats ); StreamingReporterBase::testCaseEnded( testCaseStats );
if( !testCaseStats.stdOut.empty() ) if( !testCaseStats.stdOut.empty() )
stream << "##teamcity[testStdOut name='" stream << "##teamcity[testStdOut name='"
<< escape( testCaseStats.testInfo.name ) << escape( testCaseStats.testInfo.name )
<< "' out='" << escape( testCaseStats.stdOut ) << "']\n"; << "' out='" << escape( testCaseStats.stdOut ) << "']\n";
if( !testCaseStats.stdErr.empty() ) if( !testCaseStats.stdErr.empty() )
stream << "##teamcity[testStdErr name='" stream << "##teamcity[testStdErr name='"
<< escape( testCaseStats.testInfo.name ) << escape( testCaseStats.testInfo.name )
<< "' out='" << escape( testCaseStats.stdErr ) << "']\n"; << "' out='" << escape( testCaseStats.stdErr ) << "']\n";
stream << "##teamcity[testFinished name='" stream << "##teamcity[testFinished name='"
<< escape( testCaseStats.testInfo.name ) << "' duration='" << escape( testCaseStats.testInfo.name ) << "' duration='"
<< m_testTimer.getElapsedMilliseconds() << "']\n"; << m_testTimer.getElapsedMilliseconds() << "']\n";
stream.flush(); stream.flush();
} }
private: private:
void printSectionHeader( std::ostream& os ) { void printSectionHeader( std::ostream& os ) {
assert( !m_sectionStack.empty() ); assert( !m_sectionStack.empty() );
if( m_sectionStack.size() > 1 ) { if( m_sectionStack.size() > 1 ) {
os << getLineOfChars<'-'>() << "\n"; os << getLineOfChars<'-'>() << "\n";
std::vector<SectionInfo>::const_iterator std::vector<SectionInfo>::const_iterator
it = m_sectionStack.begin()+1, // Skip first section (test case) it = m_sectionStack.begin()+1, // Skip first section (test case)
itEnd = m_sectionStack.end(); itEnd = m_sectionStack.end();
for( ; it != itEnd; ++it ) for( ; it != itEnd; ++it )
printHeaderString( os, it->name ); printHeaderString( os, it->name );
os << getLineOfChars<'-'>() << "\n"; os << getLineOfChars<'-'>() << "\n";
} }
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
os << lineInfo << "\n"; os << lineInfo << "\n";
os << getLineOfChars<'.'>() << "\n\n"; os << getLineOfChars<'.'>() << "\n\n";
} }
// if string has a : in first line will set indent to follow it on // if string has a : in first line will set indent to follow it on
// subsequent lines // subsequent lines
static void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) { static void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
std::size_t i = _string.find( ": " ); std::size_t i = _string.find( ": " );
if( i != std::string::npos ) if( i != std::string::npos )
i+=2; i+=2;
else else
i = 0; i = 0;
os << Column( _string ) os << Column( _string )
.indent( indent+i) .indent( indent+i)
.initialIndent( indent ) << "\n"; .initialIndent( indent ) << "\n";
} }
private: private:
bool m_headerPrintedForThisSection = false; bool m_headerPrintedForThisSection = false;
Timer m_testTimer; Timer m_testTimer;
}; };
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
TeamCityReporter::~TeamCityReporter() {} TeamCityReporter::~TeamCityReporter() {}
#endif #endif
CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter ) CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
} // end namespace Catch } // end namespace Catch
#ifdef __clang__ #ifdef __clang__
# pragma clang diagnostic pop # pragma clang diagnostic pop
#endif #endif
#endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED

@ -1,127 +1,127 @@
//============================================================================= //=============================================================================
// //
// Copyright (c) 2021-2022 Qualcomm Technologies, Inc. // Copyright (c) 2021-2022 Qualcomm Technologies, Inc.
// All Rights Reserved. // All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc. // Confidential and Proprietary - Qualcomm Technologies, Inc.
// //
//============================================================================= //=============================================================================
#ifndef DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP #ifndef DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP
#define DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP #define DL_SYSTEM_IOBUFFER_DATATYPE_MAP_HPP
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include "DlSystem/DlEnums.hpp" #include "DlSystem/DlEnums.hpp"
namespace DlSystem namespace DlSystem
{ {
// Forward declaration of IOBufferDataTypeMapImpl implementation. // Forward declaration of IOBufferDataTypeMapImpl implementation.
class IOBufferDataTypeMapImpl; class IOBufferDataTypeMapImpl;
} }
namespace zdl namespace zdl
{ {
namespace DlSystem namespace DlSystem
{ {
/** @addtogroup c_plus_plus_apis C++ /** @addtogroup c_plus_plus_apis C++
@{ */ @{ */
/** /**
* @brief . * @brief .
* *
* The IoBufferDataTypeMap class definition * The IoBufferDataTypeMap class definition
*/ */
class ZDL_EXPORT IOBufferDataTypeMap final class ZDL_EXPORT IOBufferDataTypeMap final
{ {
public: public:
/** /**
* @brief . * @brief .
* *
* Creates a new Buffer Data type map * Creates a new Buffer Data type map
* *
*/ */
IOBufferDataTypeMap(); IOBufferDataTypeMap();
/** /**
* @brief Adds a name and the corresponding buffer data type * @brief Adds a name and the corresponding buffer data type
* to the map * to the map
* *
* @param[name] name The name of the buffer * @param[name] name The name of the buffer
* @param[bufferDataType] buffer Data Type of the buffer * @param[bufferDataType] buffer Data Type of the buffer
* *
* @note If a buffer with the same name already exists, no new * @note If a buffer with the same name already exists, no new
* buffer is added. * buffer is added.
*/ */
void add(const char* name, zdl::DlSystem::IOBufferDataType_t bufferDataType); void add(const char* name, zdl::DlSystem::IOBufferDataType_t bufferDataType);
/** /**
* @brief Removes a buffer name from the map * @brief Removes a buffer name from the map
* *
* @param[name] name The name of the buffer * @param[name] name The name of the buffer
* *
*/ */
void remove(const char* name); void remove(const char* name);
/** /**
* @brief Returns the type of the named buffer * @brief Returns the type of the named buffer
* *
* @param[name] name The name of the buffer * @param[name] name The name of the buffer
* *
* @return The type of the buffer, or UNSPECIFIED if the buffer does not exist * @return The type of the buffer, or UNSPECIFIED if the buffer does not exist
* *
*/ */
zdl::DlSystem::IOBufferDataType_t getBufferDataType(const char* name); zdl::DlSystem::IOBufferDataType_t getBufferDataType(const char* name);
/** /**
* @brief Returns the type of the first buffer * @brief Returns the type of the first buffer
* *
* @return The type of the first buffer, or UNSPECIFIED if the map is empty. * @return The type of the first buffer, or UNSPECIFIED if the map is empty.
* *
*/ */
zdl::DlSystem::IOBufferDataType_t getBufferDataType(); zdl::DlSystem::IOBufferDataType_t getBufferDataType();
/** /**
* @brief Returns the size of the buffer type map. * @brief Returns the size of the buffer type map.
* *
* @return The size of the map * @return The size of the map
* *
*/ */
size_t size(); size_t size();
/** /**
* @brief Checks the existence of the named buffer in the map * @brief Checks the existence of the named buffer in the map
* *
* @return True if the named buffer exists, false otherwise. * @return True if the named buffer exists, false otherwise.
* *
*/ */
bool find(const char* name); bool find(const char* name);
/** /**
* @brief Resets the map * @brief Resets the map
* *
*/ */
void clear(); void clear();
/** /**
* @brief Checks whether the map is empty * @brief Checks whether the map is empty
* *
* @return True if the map is empty, false otherwise. * @return True if the map is empty, false otherwise.
* *
*/ */
bool empty(); bool empty();
/** /**
* @brief Destroys the map * @brief Destroys the map
* *
*/ */
~IOBufferDataTypeMap(); ~IOBufferDataTypeMap();
private: private:
std::shared_ptr<::DlSystem::IOBufferDataTypeMapImpl> m_IOBufferDataTypeMapImpl; std::shared_ptr<::DlSystem::IOBufferDataTypeMapImpl> m_IOBufferDataTypeMapImpl;
}; };
} }
} }
#endif #endif

Loading…
Cancel
Save