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

          Line data    Source code
       1             : // Copyright 2024 Accenture.
       2             : 
       3             : #include "estd/big_endian.h"
       4             : 
       5             : #include <gmock/gmock.h>
       6             : using namespace ::testing;
       7             : 
       8           3 : TEST(BigEndianExample, read_u16)
       9             : {
      10             :     // [EXAMPLE_READ_U16_START]
      11           1 :     uint8_t const buffer[] = {0xAB, 0x12};
      12           1 :     EXPECT_EQ(0xAB12U, ::estd::read_be<uint16_t>(&buffer[0]));
      13             :     // [EXAMPLE_READ_U16_END]
      14           1 : }
      15             : 
      16           3 : TEST(BigEndianExample, write_u32)
      17             : {
      18             :     // [EXAMPLE_WRITE_U32_START]
      19           1 :     uint8_t buffer[4] = {0};
      20           1 :     ::estd::write_be<uint32_t>(&buffer[0], 0x12345678);
      21           1 :     EXPECT_THAT(buffer, ElementsAre(0x12, 0x34, 0x56, 0x78));
      22             :     // [EXAMPLE_WRITE_U32_END]
      23           1 : }

Generated by: LCOV version 1.14