-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsingleton_test.cpp
More file actions
32 lines (28 loc) · 814 Bytes
/
singleton_test.cpp
File metadata and controls
32 lines (28 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "Singleton.hpp"
#include <gtest/gtest.h>
//TEST(DatabaseTests, IsSingletonTest)
//{
// auto& db = SingletonDatabase::get();
// auto& db2 = SingletonDatabase::get();
// ASSERT_EQ(1, db.instance_count);
// ASSERT_EQ(1, db2.instance_count);
//}
TEST(RecordFinderTests, SingletonTotalPopulationTest)
{
SingletonRecordFinder rf;
std::vector<std::string> names{ "Seoul", "Mexico City" };
int tp = rf.total_population(names);
EXPECT_EQ(17500000 + 17400000, tp);
}
TEST(RecordFinderTests, DependantTotalPopulationTest)
{
DummyDatabase db{};
ConfigurableRecordFinder rf{ db };
EXPECT_EQ(4, rf.total_population(
std::vector<std::string>{"alpha", "gamma"}));
}
int dsfmain(int ac, char* av[])
{
testing::InitGoogleTest(&ac, av);
return RUN_ALL_TESTS();
}