/
oop_nust_misis
/
notifications-sofaming
Обзор
Документация
Войти
/
oop_nust_misis
/
notifications-sofaming
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
master
tests/test_basic.cpp
32 строки
955 B
OOP Nust MISIS
Initial commit
27 мар 2025, 16:13
27 мар 2025, 16:13
4366a0b
Код
Авторство
О чём код?
#include <gtest/gtest.h> #include <sstream> #include "library.hpp" TEST(SmsNotifierTest, SendsCorrectSms) { std::ostringstream output; std::streambuf* old_cout_buffer = std::cout.rdbuf(output.rdbuf()); template_library::SmsNotifier sms("+7-495-777-77-77"); sms.Notify("Hello! How are you?"); std::cout.rdbuf(old_cout_buffer); EXPECT_EQ(output.str(), "Send 'Hello! How are you?' to number +7-495-777-77-77\n"); } TEST(EmailNotifierTest, SendsCorrectEmail) { std::ostringstream output; std::streambuf* old_cout_buffer = std::cout.rdbuf(output.rdbuf()); template_library::EmailNotifier email("test@mail.ru"); email.Notify("Let's learn C++!"); std::cout.rdbuf(old_cout_buffer); EXPECT_EQ(output.str(), "Send 'Let's learn C++!' to e-mail test@mail.ru\n"); } int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }