Google Test
Vcpkg
Our great sponsors
Google Test | Vcpkg | |
---|---|---|
67 | 146 | |
33,091 | 21,500 | |
2.7% | 2.2% | |
8.3 | 10.0 | |
8 days ago | about 7 hours ago | |
C++ | CMake | |
BSD 3-clause "New" or "Revised" License | MIT 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.
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
Vcpkg
-
Backdoor in upstream xz/liblzma leading to SSH server compromise
5.4.5 can be compromised
https://github.com/microsoft/vcpkg/issues/37197
- GitHub - microsoft/vcpkg: C++ Library Manager for Windows, Linux, and MacOS
-
Dependencies Belong in Version Control
vcpkg may expire assets after 1.5 years, so achieve long-term reproducibility you will need to cache your dependencies.... Somewhere. Not sure what the expected solution is.
https://github.com/microsoft/vcpkg/pull/30546#issuecomment-1...
-
My first Software Release using GitHub Release
There were various approaches recommended depending on our language and ecosystem. My classmates who developed using Node.js were recommended npm, and PyPI or poetry for Python. Since my program is written in C++, I was recommended to look into one of vcpkg or conan, but I ultimately did not use either package manager.
-
Anyone else frustrated with Conan2?
Which dependencies are not in vcpkg? We can ask them to add it. It’s pretty easy just open an issue there https://github.com/microsoft/vcpkg/issues .
-
How to install libraries for c++ on a Linux CentOS supercomputer where I'm not a sudoer
./vcpkg search netcdf gdal[netcdf] Enable NetCDF support minc 2.4.03#3 MINC - Medical Image NetCDF or MINC isn't netCDF minc[minc1] Support minc1 file format, requires NETCDF netcdf-c 4.8.1#2 A set of self-describing, machine-independent data formats that support th... netcdf-c[dap] Build with DAP remote access client support netcdf-c[hdf5] Build with HDF5 support netcdf-c[nczarr] Build with NCZarr cloud storage access support netcdf-c[nczarr-zip] Build with NCZarr ZIP support netcdf-c[netcdf-4] Build with netCDF-4 support netcdf-c[platform-default-features] Enable platform-dependent default features netcdf-c[tools] Build utilities netcdf-cxx4 4.3.1#4 a set of machine-independent data formats that support the creation, acces... The result may be outdated. Run `git pull` to get the latest results. If your port is not listed, please open an issue at and/or consider making a pull request. - https://github.com/Microsoft/vcpkg/issues
- Does anyone has a idea to read out dependencies out of c/cpp directories to create .sbom files?
-
hypergrep: A new "fastest grep" to search directories recursively for a regex pattern
The hyperscan update to vcpkg seems to have happened from 5.4.0 to 5.4.2 in this commit on Apr 20.
-
Configuring incomplete due to CMake Error(missing OpenCVConfig.cmake ProtobufConfig.cmake and TIFF etc.)
Dear Fictrac team, I am hoping to install Fictrac in our windows 11 x64 laptop (Visual Studio 2019, cMake 3.26.4). I followed the installation guideline on github page fictrac and used the latest vcpkg
-
Why does Arch Linux have a vulkan-devel group, but does not package the LunarG Vulkan SDK?
This works fine if one wants to do stuff like clang main.cpp -lvulkan, or even find_package(Vulkan REQUIRED) in CMake, but it doesn't define VULKAN_SDK, and therefore doesn't work with vcpkg's Vulkan support, for instance. A fair bit of Vulkan development, tutorials, etc. assume that the entire SDK is installed, as-is.
What are some alternatives?
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)
conan - Conan - The open-source C and C++ package manager
Boost.Test - The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
CPM.cmake - 📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
CppUTest - CppUTest unit testing and mocking framework for C/C++
Boost.Program_options - Boost.org program_options module
CppUnit - C++ port of JUnit
Ncurses - ncurses Git mirror
doctest - The fastest feature-rich C++11/14/17/20/23 single-header testing framework
vulkan - Haskell bindings for Vulkan
Unity Test API - Simple Unit Testing for C
meson - The Meson Build System