LCOV - code coverage report
Current view: top level - estd/examples - constructor.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 11 11 100.0 %
Date: 2025-01-20 13:53:09 Functions: 3 4 75.0 %

          Line data    Source code
       1             : // Copyright 2024 Accenture.
       2             : 
       3             : #include "estd/constructor.h"
       4             : 
       5             : #include "estd/vector.h"
       6             : 
       7             : #include <gtest/gtest.h>
       8             : 
       9           1 : void emplaceExample(::estd::vector<int>& v)
      10             : {
      11             :     // EXAMPLE_BEGIN emplaceExample
      12           6 :     for (int i = 0; i < 5; ++i)
      13             :     {
      14           5 :         v.emplace_back().construct(i);
      15             :     }
      16             : 
      17             :     // Creating another vector
      18           1 :     estd::declare::vector<int, 5> v2;
      19             : 
      20             :     // Use construct to emplace_back element to the constructor v.
      21           1 :     v2.emplace_back().construct(1);
      22             : 
      23             :     // Use emplace to append elements
      24           1 :     v2.emplace(v2.cend()).construct(6);
      25             :     // EXAMPLE_END emplaceExample
      26           1 : }
      27             : 
      28           3 : TEST(constructor_test, run_examples)
      29             : {
      30           1 :     estd::declare::vector<int, 5> a;
      31           1 :     emplaceExample(a);
      32           1 : }

Generated by: LCOV version 1.14