Initial Course
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#include "smart_pointers.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(SmartPointers, MakeCounter) {
|
||||
auto counter = cpp11::make_counter(42);
|
||||
ASSERT_NE(counter, nullptr);
|
||||
EXPECT_EQ(*counter, 42);
|
||||
}
|
||||
|
||||
TEST(SmartPointers, SharedTotal) {
|
||||
std::vector<std::shared_ptr<int>> values;
|
||||
values.push_back(std::make_shared<int>(1));
|
||||
values.push_back(std::make_shared<int>(2));
|
||||
EXPECT_EQ(cpp11::shared_total(values), 3);
|
||||
}
|
||||
|
||||
TEST(SmartPointers, CloneUnique) {
|
||||
auto original = cpp11::make_counter(7);
|
||||
auto copy = cpp11::clone_unique(original);
|
||||
ASSERT_NE(copy, nullptr);
|
||||
EXPECT_EQ(*copy, 7);
|
||||
}
|
||||
Reference in New Issue
Block a user