/
thomas-king
/
SourceManager
Обзор
Документация
Войти
/
thomas-king
/
SourceManager
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
test/ClassDeclarationTests/SourceManagerTests.cpp
40 строк
907 B
Ace Rodstin
Task #39. Add write capability to SourceManager.
24 окт 2023, 15:32
24 окт 2023, 15:32
bfd3834
Код
Авторство
О чём код?
// // SourceManagerTests.cpp // SourceManager // // Created by Ace Rodstin on 10/24/23. // Updated by Ace Rodstin on 10/24/23. // // Copyright © 2023 Ace Rodstin. All rights reserved. // #include <gtest/gtest.h> #include "Services/SourceManager.h" #include <sstream> using namespace std; TEST(SourceManagerTests, readSourceCode) { // Given string expected = "int value = 1;"; // When SourceManager sourceManager {}; auto result = sourceManager.read(INPUT_FILE); // Then EXPECT_STREQ(result.c_str(), expected.c_str()); } TEST(SourceManagerTests, writeSourceCode) { // Given string expected = "int test = 1;"; // When SourceManager sourceManager {}; sourceManager.write(OUTPUT_FILE, expected, SourceManager::WriteOption::REPLACE); auto result = sourceManager.read(OUTPUT_FILE); // Then EXPECT_STREQ(result.c_str(), expected.c_str()); }