github.phpd.cn/thought-machine/please@v12.2.0+incompatible/src/test/test_data/gcov_coverage.gcov (about)

     1          -:    0:Source:/usr/include/unittest++/Checks.h
     2          -:    0:Programs:3
     3          -:    1:#ifndef UNITTEST_CHECKS_H
     4          -:    2:#define UNITTEST_CHECKS_H
     5          -:    3:
     6          -:    4:#include "Config.h"
     7          -:    5:#include "TestResults.h"
     8          -:    6:#include "MemoryOutStream.h"
     9          -:    7:
    10          -:    8:namespace UnitTest {
    11          -:    9:
    12          -:   10:
    13          -:   11:   template< typename Value >
    14          -:   12:   bool Check(Value const value)
    15          -:   13:   {
    16          -:   14:      return !!value; // doing double negative to avoid silly VS warnings
    17          -:   15:   }
    18          -:   16:
    19          -:   17:
    20          -:   18:   template< typename Expected, typename Actual >
    21          2:   19:   void CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details)
    22          -:   20:   {
    23          2:   21:      if (!(expected == actual))
    24          -:   22:      {
    25      #####:   23:         UnitTest::MemoryOutStream stream;
    26      #####:   24:         stream << "Expected " << expected << " but was " << actual;
    27          -:   25:
    28      #####:   26:         results.OnTestFailure(details, stream.GetText());
    29          -:   27:      }
    30          2:   28:   }
    31          -:   29:
    32          -:   30:   UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details);
    33          -:   31:
    34          -:   32:   UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details);
    35          -:   33:
    36          -:   34:   UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details);
    37          -:   35:
    38          -:   36:   UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char* actual, TestDetails const& details);
    39          -:   37:
    40          -:   38:   template< typename Expected, typename Actual, typename Tolerance >
    41          -:   39:   bool AreClose(Expected const& expected, Actual const& actual, Tolerance const& tolerance)
    42          -:   40:   {
    43          -:   41:      return (actual >= (expected - tolerance)) && (actual <= (expected + tolerance));
    44          -:   42:   }
    45          -:   43:
    46          -:   44:   template< typename Expected, typename Actual, typename Tolerance >
    47          -:   45:   void CheckClose(TestResults& results, Expected const& expected, Actual const& actual, Tolerance const& tolerance,
    48          -:   46:                   TestDetails const& details)
    49          -:   47:   {
    50          -:   48:      if (!AreClose(expected, actual, tolerance))
    51          -:   49:      {
    52          -:   50:         UnitTest::MemoryOutStream stream;
    53          -:   51:         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
    54          -:   52:
    55          -:   53:         results.OnTestFailure(details, stream.GetText());
    56          -:   54:      }
    57          -:   55:   }
    58          -:   56:
    59          -:   57:
    60          -:   58:   template< typename Expected, typename Actual >
    61          -:   59:   void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual,
    62          -:   60:                        int const count, TestDetails const& details)
    63          -:   61:   {
    64          -:   62:      bool equal = true;
    65          -:   63:      for (int i = 0; i < count; ++i)
    66          -:   64:         equal &= (expected[i] == actual[i]);
    67          -:   65:
    68          -:   66:      if (!equal)
    69          -:   67:      {
    70          -:   68:         UnitTest::MemoryOutStream stream;
    71          -:   69:
    72          -:   70:         stream << "Expected [ ";
    73          -:   71:
    74          -:   72:         for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
    75          -:   73:            stream << expected[expectedIndex] << " ";
    76          -:   74:
    77          -:   75:         stream << "] but was [ ";
    78          -:   76:
    79          -:   77:         for (int actualIndex = 0; actualIndex < count; ++actualIndex)
    80          -:   78:            stream << actual[actualIndex] << " ";
    81          -:   79:
    82          -:   80:         stream << "]";
    83          -:   81:
    84          -:   82:         results.OnTestFailure(details, stream.GetText());
    85          -:   83:      }
    86          -:   84:   }
    87          -:   85:
    88          -:   86:   template< typename Expected, typename Actual, typename Tolerance >
    89          -:   87:   bool ArrayAreClose(Expected const& expected, Actual const& actual, int const count, Tolerance const& tolerance)
    90          -:   88:   {
    91          -:   89:      bool equal = true;
    92          -:   90:      for (int i = 0; i < count; ++i)
    93          -:   91:         equal &= AreClose(expected[i], actual[i], tolerance);
    94          -:   92:      return equal;
    95          -:   93:   }
    96          -:   94:
    97          -:   95:   template< typename Expected, typename Actual, typename Tolerance >
    98          -:   96:   void CheckArrayClose(TestResults& results, Expected const& expected, Actual const& actual,
    99          -:   97:                        int const count, Tolerance const& tolerance, TestDetails const& details)
   100          -:   98:   {
   101          -:   99:      bool equal = ArrayAreClose(expected, actual, count, tolerance);
   102          -:  100:
   103          -:  101:      if (!equal)
   104          -:  102:      {
   105          -:  103:         UnitTest::MemoryOutStream stream;
   106          -:  104:
   107          -:  105:         stream << "Expected [ ";
   108          -:  106:         for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
   109          -:  107:            stream << expected[expectedIndex] << " ";
   110          -:  108:         stream << "] +/- " << tolerance << " but was [ ";
   111          -:  109:
   112          -:  110:         for (int actualIndex = 0; actualIndex < count; ++actualIndex)
   113          -:  111:            stream << actual[actualIndex] << " ";
   114          -:  112:         stream << "]";
   115          -:  113:
   116          -:  114:         results.OnTestFailure(details, stream.GetText());
   117          -:  115:      }
   118          -:  116:   }
   119          -:  117:
   120          -:  118:   template< typename Expected, typename Actual, typename Tolerance >
   121          -:  119:   void CheckArray2DClose(TestResults& results, Expected const& expected, Actual const& actual,
   122          -:  120:                          int const rows, int const columns, Tolerance const& tolerance, TestDetails const& details)
   123          -:  121:   {
   124          -:  122:      bool equal = true;
   125          -:  123:      for (int i = 0; i < rows; ++i)
   126          -:  124:         equal &= ArrayAreClose(expected[i], actual[i], columns, tolerance);
   127          -:  125:
   128          -:  126:      if (!equal)
   129          -:  127:      {
   130          -:  128:         UnitTest::MemoryOutStream stream;
   131          -:  129:
   132          -:  130:         stream << "Expected [ ";
   133          -:  131:
   134          -:  132:         for (int expectedRow = 0; expectedRow < rows; ++expectedRow)
   135          -:  133:         {
   136          -:  134:            stream << "[ ";
   137          -:  135:            for (int expectedColumn = 0; expectedColumn < columns; ++expectedColumn)
   138          -:  136:               stream << expected[expectedRow][expectedColumn] << " ";
   139          -:  137:            stream << "] ";
   140          -:  138:         }
   141          -:  139:
   142          -:  140:         stream << "] +/- " << tolerance << " but was [ ";
   143          -:  141:
   144          -:  142:         for (int actualRow = 0; actualRow < rows; ++actualRow)
   145          -:  143:         {
   146          -:  144:            stream << "[ ";
   147          -:  145:            for (int actualColumn = 0; actualColumn < columns; ++actualColumn)
   148          -:  146:               stream << actual[actualRow][actualColumn] << " ";
   149          -:  147:            stream << "] ";
   150          -:  148:         }
   151          -:  149:
   152          -:  150:         stream << "]";
   153          -:  151:
   154          -:  152:         results.OnTestFailure(details, stream.GetText());
   155          -:  153:      }
   156          -:  154:   }
   157          -:  155:
   158          -:  156:}
   159          -:  157:
   160          -:  158:#endif
   161          -:    0:Source:test/cc_rules/deps_test.cc
   162          -:    0:Programs:3
   163          -:    1:/*EOF*/
   164          -:    2:/*EOF*/
   165          -:    3:/*EOF*/
   166          -:    4:/*EOF*/
   167          -:    5:/*EOF*/
   168          -:    6:/*EOF*/
   169          -:    7:/*EOF*/
   170          -:    8:/*EOF*/
   171          -:    9:/*EOF*/
   172          3:   10:/*EOF*/
   173          1:   11:/*EOF*/
   174          1:   12:/*EOF*/
   175          -:   13:/*EOF*/
   176          3:   14:/*EOF*/
   177          1:   15:/*EOF*/
   178          1:   16:/*EOF*/
   179          -:   17:/*EOF*/
   180          3:   18:/*EOF*/
   181          -:    0:Source:test/cc_rules/lib1.cc
   182          -:    0:Programs:3
   183          -:    1:/*EOF*/
   184          -:    2:/*EOF*/
   185          -:    3:/*EOF*/
   186          -:    4:/*EOF*/
   187          1:    5:/*EOF*/
   188          1:    6:/*EOF*/
   189          -:    0:Source:test/cc_rules/lib2.cc
   190          -:    0:Programs:3
   191          -:    1:/*EOF*/
   192          -:    2:/*EOF*/
   193          -:    3:/*EOF*/
   194          -:    4:/*EOF*/
   195          1:    5:/*EOF*/
   196          1:    6:/*EOF*/
   197          -:    0:Source:/usr/include/unittest++/MemoryOutStream.h
   198          -:    0:Programs:3
   199          -:    1:#ifndef UNITTEST_MEMORYOUTSTREAM_H
   200          -:    2:#define UNITTEST_MEMORYOUTSTREAM_H
   201          -:    3:
   202          -:    4:#include "Config.h"
   203          -:    5:#include "HelperMacros.h"
   204          -:    6:
   205          -:    7:#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
   206          -:    8:
   207          -:    9:#include <sstream>
   208          -:   10:
   209          -:   11:namespace UnitTest
   210          -:   12:{
   211          -:   13:
   212          -:   14:   class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream
   213          -:   15:   {
   214          -:   16:   public:
   215      #####:   17:      MemoryOutStream() {}
   216      #####:   18:      ~MemoryOutStream() {}
   217          -:   19:      void Clear();
   218          -:   20:      char const* GetText() const;
   219          -:   21:
   220          -:   22:   private:
   221          -:   23:      MemoryOutStream(MemoryOutStream const&);
   222          -:   24:      void operator =(MemoryOutStream const&);
   223          -:   25:
   224          -:   26:      mutable std::string m_text;
   225          -:   27:   };
   226          -:   28:
   227          -:   29:#ifdef UNITTEST_COMPILER_IS_MSVC6
   228          -:   30:   std::ostream& operator<<(std::ostream& stream, __int64 const n);
   229          -:   31:   std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n);
   230          -:   32:#endif
   231          -:   33:
   232          -:   34:}
   233          -:   35:
   234          -:   36:#else
   235          -:   37:
   236          -:   38:#include <cstddef>
   237          -:   39:
   238          -:   40:#ifdef UNITTEST_COMPILER_IS_MSVC6
   239          -:   41:namespace std {}
   240          -:   42:#endif
   241          -:   43:
   242          -:   44:namespace UnitTest
   243          -:   45:{
   244          -:   46:
   245          -:   47:   class UNITTEST_LINKAGE MemoryOutStream
   246          -:   48:   {
   247          -:   49:   public:
   248          -:   50:      explicit MemoryOutStream(int const size = 256);
   249          -:   51:      ~MemoryOutStream();
   250          -:   52:
   251          -:   53:      void Clear();
   252          -:   54:      char const* GetText() const;
   253          -:   55:
   254          -:   56:      MemoryOutStream& operator <<(char const* txt);
   255          -:   57:      MemoryOutStream& operator <<(int n);
   256          -:   58:      MemoryOutStream& operator <<(long n);
   257          -:   59:      MemoryOutStream& operator <<(unsigned long n);
   258          -:   60:#ifdef UNITTEST_COMPILER_IS_MSVC6
   259          -:   61:      MemoryOutStream& operator <<(__int64 n);
   260          -:   62:      MemoryOutStream& operator <<(unsigned __int64 n);
   261          -:   63:#else
   262          -:   64:      MemoryOutStream& operator <<(long long n);
   263          -:   65:      MemoryOutStream& operator <<(unsigned long long n);
   264          -:   66:#endif
   265          -:   67:      MemoryOutStream& operator <<(float f);
   266          -:   68:      MemoryOutStream& operator <<(double d);
   267          -:   69:      MemoryOutStream& operator <<(void const* p);
   268          -:   70:      MemoryOutStream& operator <<(unsigned int s);
   269          -:   71:
   270          -:   72:      enum { GROW_CHUNK_SIZE = 32 };
   271          -:   73:      int GetCapacity() const;
   272          -:   74:
   273          -:   75:   private:
   274          -:   76:      void operator= (MemoryOutStream const&);
   275          -:   77:      void GrowBuffer(int capacity);
   276          -:   78:
   277          -:   79:      int m_capacity;
   278          -:   80:      char* m_buffer;
   279          -:   81:   };
   280          -:   82:
   281          -:   83:}
   282          -:   84:
   283          -:   85:#endif
   284          -:   86:
   285          -:   87:#endif
   286          -:    0:Source:/usr/include/unittest++/TestSuite.h
   287          -:    0:Programs:3
   288          -:    1:#ifndef UNITTEST_TESTSUITE_H
   289          -:    2:#define UNITTEST_TESTSUITE_H
   290          -:    3:
   291          -:    4:namespace UnitTestSuite
   292          -:    5:{
   293          2:    6:   inline char const* GetSuiteName ()
   294          -:    7:   {
   295          2:    8:      return "DefaultSuite";
   296          -:    9:   }
   297          -:   10:}
   298          -:   11:
   299          -:   12:#endif