LCOV - code coverage report
Current view: top level - impl/test/test_support - wrap_new.cpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 7 7 100.0 %
Date: 2021-08-31 11:34:43 Functions: 1 1 100.0 %
Branches: 5 8 62.5 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
       3                 :            :  *
       4                 :            :  * Copyright (C) 2018-2019 Intel Corporation
       5                 :            :  *
       6                 :            :  * SPDX-License-Identifier: LGPL-2.1-only
       7                 :            :  *
       8                 :            :  * ----------------- END LICENSE BLOCK -----------------------------------
       9                 :            :  */
      10                 :            : 
      11                 :            : #include "wrap_new.hpp"
      12                 :            : #include <malloc.h>
      13                 :            : 
      14                 :            : uint64_t gNewThrowCounter{0u};
      15                 :            : uint64_t gNewThrowSize{0u};
      16                 :            : 
      17                 :   16761600 : void *operator new(std::size_t count)
      18                 :            : {
      19         [ +  + ]:   16761600 :   if (gNewThrowCounter > 0u)
      20                 :            :   {
      21   [ -  +  -  - ]:      12483 :     if ((gNewThrowSize == 0u) || (gNewThrowSize == count))
      22                 :            :     {
      23                 :      12483 :       gNewThrowCounter--;
      24                 :            :     }
      25         [ +  + ]:      12483 :     if (gNewThrowCounter == 0u)
      26                 :            :     {
      27                 :        365 :       throw std::bad_alloc();
      28                 :            :     }
      29                 :            :   }
      30                 :   16761200 :   return malloc(count);
      31                 :            : }

Generated by: LCOV version 1.14