File: singleton_tests.cpp

package info (click to toggle)
cpr 1.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,452 kB
  • sloc: cpp: 14,315; ansic: 637; sh: 139; xml: 38; makefile: 16
file content (23 lines) | stat: -rw-r--r-- 638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <gtest/gtest.h>

#include "singleton_tests.hpp"

// NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables)
CPR_SINGLETON_IMPL(TestSingleton)

TEST(SingletonTests, GetInstanceTest) {
    const TestSingleton* singleton = TestSingleton::GetInstance();
    EXPECT_NE(singleton, nullptr);
}

TEST(SingletonTests, ExitInstanceTest) {
    TestSingleton* singleton = TestSingleton::GetInstance();
    TestSingleton::ExitInstance();
    singleton = TestSingleton::GetInstance();
    EXPECT_EQ(singleton, nullptr);
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}