Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 4988926
Author: drew5494 <tassoone@gmail.com>
Date:   Fri Nov 12 22:48:40 2021 -0500

    Add to contributing

commit 668851f
Author: drew5494 <tassoone@gmail.com>
Date:   Fri Nov 12 22:44:27 2021 -0500

    Add google tester
  • Loading branch information
drew5494 committed Nov 13, 2021
1 parent d2ce6ee commit e12b58f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ command.</p>
<p>Before committing any changes, be sure to follow these steps.</p>
<ul>
<li>Ensure you have <code>clang-format</code> installed in VSCode</li>
<li>Download Google Test with cMake and ensure all tests pass without errors</li>
</ul>
22 changes: 19 additions & 3 deletions thegreatsitegenerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@ cmake_minimum_required(VERSION 3.10)
# Name of the project
project(TGSG VERSION 0.1)

configure_file(TGSGConfig.h.in TGSGConfig.h)

# Build for C++17
set(CMAKE_CXX_STANDARD 17)

configure_file(TGSGConfig.h.in TGSGConfig.h)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

enable_testing()

add_executable(
tgsg
main.cpp
reading-test.cpp
)
target_link_libraries(
tgsg
gtest_main
)
include(GoogleTest)
gtest_discover_tests(tgsg)
27 changes: 27 additions & 0 deletions thegreatsitegenerator/reading-test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "reading.h"
#include <gtest/gtest.h>
// Demonstrate some basic assertions.
using namespace std;
TEST(fileTest, BasicAssertions)
{
std::string testerTextfile = "the-great-site-generator-sample.txt";
Reading r;
r.readFile(testerTextfile, 1);
ifstream ifile;
ifile.open("dist/the-great-site-generator-sample.html");
if (ifile) {
cout << "file exists";
string line;
for (int i = 0; i < 11; i++) {
std::getline(ifile, line);
}
string first = "<p>The GREAT Site Generator is actually just another simple site generator that can generate static sites based off of text data.</p>";
EXPECT_EQ(first, line);
}
}
TEST(folderTest, BasicAssertions)
{
std::string testerTextFolder = "sample";
Reading r;
r.readFolder(testerTextFolder, 1);
}

0 comments on commit e12b58f

Please sign in to comment.