The fixture for testing class Foo.
| 25 | |
| 26 | // The fixture for testing class Foo. |
| 27 | class NanoLogTest : public ::testing::Test { |
| 28 | protected: |
| 29 | // You can remove any or all of the following functions if its body |
| 30 | // is empty. |
| 31 | uint32_t bufferSize; |
| 32 | uint32_t halfSize; |
| 33 | RuntimeLogger::StagingBuffer *sb; |
| 34 | |
| 35 | NanoLogTest() |
| 36 | : bufferSize(NanoLogConfig::STAGING_BUFFER_SIZE) |
| 37 | , halfSize(bufferSize/2) |
| 38 | , sb(new RuntimeLogger::StagingBuffer(0)) |
| 39 | { |
| 40 | static_assert(1024 <= NanoLogConfig::STAGING_BUFFER_SIZE, |
| 41 | "Test requires at least 1KB of buffer space"); |
| 42 | } |
| 43 | |
| 44 | virtual ~NanoLogTest() { |
| 45 | if (sb) { |
| 46 | // Since the tests screw with internal state, it's best to |
| 47 | // reset them before exiting |
| 48 | sb->producerPos = sb->consumerPos = sb->storage; |
| 49 | sb->minFreeSpace = 0; |
| 50 | delete sb; |
| 51 | } |
| 52 | |
| 53 | sb = nullptr; |
| 54 | } |
| 55 | |
| 56 | // If the constructor and destructor are not enough for setting up |
| 57 | // and cleaning up each test, you can define the following methods: |
| 58 | |
| 59 | virtual void SetUp() { |
| 60 | // Code here will be called immediately after the constructor (right |
| 61 | // before each test). |
| 62 | } |
| 63 | |
| 64 | virtual void TearDown() { |
| 65 | // Code here will be called immediately after each test (right |
| 66 | // before the destructor). |
| 67 | } |
| 68 | |
| 69 | // Objects declared here can be used by all tests in the test case for Foo. |
| 70 | }; |
| 71 | |
| 72 | TEST_F(NanoLogTest, StagingBuffer_reserveProducerSpace) |
| 73 | { |
nothing calls this directly
no outgoing calls
no test coverage detected