the-great-site-generator
Google Test
the-great-site-generator | Google Test | |
---|---|---|
10 | 67 | |
0 | 33,117 | |
- | 1.7% | |
0.0 | 8.3 | |
over 2 years ago | 4 days ago | |
C++ | C++ | |
GNU General Public License v3.0 only | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
the-great-site-generator
-
The Great Site Generator v1.0 Release
This week I focused on creating an initial v1.0 release of the project, The Great Site Generator. I was able to use Conan and Gitlab to create the release by following their guide. At first, I tried vcpkg, but found I couldn't get it to work with Gitlab. Conan was able to work well with CMake and did not require too much work. I was happy to see my project finally added to the Gitlabs registry. I had to alter my code before this release. I wanted to ensure my code looked like it was ready and added another function to get rid of the remaining global variables. I asked one of my fronds, who is not in my program, to test out my initial release by following the README.md. They did not seem to have any trouble following it, except for requiring assistance to install Conan. In order to try out TGSG, you can use the following command. conan install the-great-site-generator/1.0@root+the-great-site-generator/stable --remote=gitlab--remote=gitlab
-
Adding Continuous Integration
After setting up my own CI and ensuring everything was working properly I teamed up with Andrew Tassone to work on his SSG. I added a new test case to his that would check for proper markdown conversion with the
-
Adding Google Test - The Great Site Generator
This week I focused on adding a tester to my project. I chose to use Google Test as I have read it is a very popular tester for C++. Google Test cam be used easily with CMake which was also being used in this project. I setup the tester by changing the CMakeLists.txt which can download the Google Test folder to the root directory by only using FetchContent_Declare. While writing the test cases, I learned that it was more difficult than I had expected. I made sure my tests checked that the HTML output files were correct by reading the file and comparing it to the correct lines. I got stuck trying to get CMake to compile correctly. I eventually figured out that I did not have the correct executable files listed.
-
Adding a Linter - The Great Site Generator
This week I focused on adding clang-format to my code to have better consistency when other developers are contributing. I chose this as it has a VSCode extension and works very well with C++ which is what my project is written in.
-
Refactoring The Great Site Generator
I wanted to reduce redundancy in my code so I created a function called readFolder() for reading folders. I also combined readMarkdownFile() into readFile(). This supports both file types of either .txt or .md.
-
Adding Language Support and More! - The Great Site Generator
I will be working on adding more features soon. If you'd like to contribute, you can fork it on Github
-
Collaborating and Contributing
I had an easy time finding a partner to work with this week on Slack, but unfortunately I was transported to hospital for an unexpected injury. Oh the pain... Life is like a box of chocolates I suppose. Anyway, when I got back, my partner had already helped add markdown features to my project. I had forked his project before but unfortunately, someone else had already worked on markdown. I had fun fixing issues within my own project. I did run into a few issues like being unsure how to use CMake. I eventually figured it out with some research and was able to add versioning, as well as cross compatibility. I was surprised to learn about new features in C++17 that make cross platform much easier such as std::filesystem::path
-
Contributing to Open Source with Adding Features
Welcome to the weekly blog post about my open source journey! This weeks topic will be about adding a feature to a new an open source repository. The repository we will be working on this week will be The Great Site Generator.
-
Contributing to The Open Source Community!
Here are the links to both repository issues: Octo the-great-site-generator
-
A simple static site generator: The GREAT Site Generator v0.1
You can read more about The GREAT Site Generator and how to use it on Github.
Google Test
-
Creating k-NN with C++ (from Scratch)
cmake_minimum_required(VERSION 3.5) project(knn_cpp CXX) include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 ) FetchContent_MakeAvailable(googletest) FetchContent_Declare(matplotplusplus GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus GIT_TAG origin/master) FetchContent_GetProperties(matplotplusplus) if(NOT matplotplusplus_POPULATED) FetchContent_Populate(matplotplusplus) add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL) endif() function(knn_cpp_test TEST_NAME TEST_SOURCE) add_executable(${TEST_NAME} ${TEST_SOURCE}) target_link_libraries(${TEST_NAME} PUBLIC matplot) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../lib LIB_SOURCES) target_link_libraries(${TEST_NAME} PRIVATE gtest gtest_main gmock gmock_main) target_include_directories(${TEST_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../) target_sources(${TEST_NAME} PRIVATE ${LIB_SOURCES} ) include(GoogleTest) gtest_discover_tests(${TEST_NAME}) endfunction() knn_cpp_test(LinearAlgebraTest la_test.cc) knn_cpp_test(KnnTest knn_test.cc) knn_cpp_test(UtilsTest utils_test.cc)
-
Starting with C
Okay, time to start unit tests!!! We will use Unity Test Framework to do unit testing. It is one of widely used testing frameworks alongside with Check, Google Test etc. Just downloading source code, and putting it to the project folder is enough to make it work (that is also why it is portable).
-
Just in case: Debian Bookworm comes with a buggy GCC
Updating GCC (it happened to GoogleTest).
-
Automatically run tests, formatters & linters with CI!
Roy's project uses Google Test, a C++ testing framework. His testing setup is similar to mine as we both keep source files in one directory and tests in another. The key difference is that I can run the tests using the Visual Studios run button. It was fairly easy to write the new tests as there were existing ones that I could reference to check the syntax!
-
C++ Unit Testing Using Google Test - My Experience
The Google Test Documentation provides a primer for first-time users. The primer introduces some basic concepts and terminology, some of which I've been able to learn for this lab exercise.
-
Basic C++ Unit Testing with GTest, CMake, and Submodules
> git submodule add https://github.com/google/googletest.git > git submodule update --init --recursive
-
VS code + cmake + gtest?
cmake_minimum_required(VERSION 3.14) project(my_project) # GoogleTest requires at least C++14 set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.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( hello_test hello_test.cpp ) target_link_libraries( hello_test GTest::gtest_main ) include(GoogleTest) gtest_discover_tests(hello_test)
-
FetchContent with Multiple URLs
FetchContent\_Declare(googletestGIT\_REPOSITORY [[email protected]](mailto:[email protected]):googletest.git [https://github.com/google/googletest.git](https://github.com/google/googletest.git)GIT\_TAG release-1.12.1)FetchContent\_MakeAvailable(googletest)
-
CI/CD pipelines for embedded
Not sure about CppUnit but I can speak to my previous experience using the googletest framework which compiles your tests to an executable, and since it's a very simple framework we were able to cross-compile and run directly on our device. We just had to hook up a device to the server that was running the CI so it could flash it when needed. That basically meant that our process was:
- Basic CMake question regarding subdirectories
What are some alternatives?
octo - A tool that allows you to generate static sites based off of text data.
Catch - A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
Boost.Test - The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
CppUTest - CppUTest unit testing and mocking framework for C/C++
CppUnit - C++ port of JUnit
doctest - The fastest feature-rich C++11/14/17/20/23 single-header testing framework
Unity Test API - Simple Unit Testing for C
benchmark - A microbenchmark support library
UnitTest++ - A lightweight unit testing framework for C++
fff - A testing micro framework for creating function test doubles
spdlog - Fast C++ logging library.
Vcpkg - C++ Library Manager for Windows, Linux, and MacOS