gecode
Google Test
| gecode | Google Test | |
|---|---|---|
| 5 | 76 | |
| 328 | 38,683 | |
| 1.5% | 0.4% | |
| 0.0 | 7.1 | |
| 16 days ago | 8 days ago | |
| C++ | C++ | |
| GNU General Public License v3.0 or later | 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.
gecode
-
Solving Every Sudoku Puzzle (2006)
You will most likely need both smarter heuristics and better deductions for larger instances. As mentioned, I've seen well-engineered custom tight C++-solvers with decent heuristics and the normal deductions take >1 hour on some instances. Most cases I've tried can be solved reasonably quickly when using OR-Tools CP-SAT which uses constraint programming style lazy clause generation and custom MIP relaxations in a portfolio.
For a list of interesting instances to test, see this file: https://github.com/Gecode/gecode/blob/release/6.3.0/examples...
I should probably do some benchmarks on that with the standard MiniZinc solvers.
-
Gecode is an open source C++ toolkit for developing constraint-based systems
Adding to wavemode, the Sudoku example is a good starting point: https://github.com/Gecode/gecode/blob/master/examples/sudoku...
In the documentation (https://www.gecode.org/doc-latest/MPG.pdf) there are a lot of worked examples as well.
-
Send+more=money and how to use forward-checking in search
Sure, there are lots but I think it should be doable. Will probably try sometime. Easiest is to make a model that fixes the lengths of the words, and just run it for different word lengths.
As a comparison, see this model solving crosswords using constraint programming. https://github.com/Gecode/gecode/blob/develop/examples/cross...
-
Testing non-trivial software (C++)
The main idea is that one defines tests that post the propagator on an initial domain, and then adding a checker for ground instances if it is a solution. The testing infrastructure runs the propagator in simulated setting, making sure that non-solutions are pruned and that solutions are found. Here is an example for the sorted constraint: sorted.cpp
Google Test
-
How far does lookup see in C++?
Someone might wonder why this code was written this way. Most likely, it's purpose to output additional debug information during GoogleTest execution. The docs suggest several ways to place the PrintTo function. In our case, the developer would like to hide the function while still making it discoverable through ADL, which we cover today. In brief, it allows a compiler to get access to the function through parameter types.
-
Trying Out C++26 Executors
> it always makes me wonder how developers these days reason about what the code is actually going to compile to and perform like
What will it compile to? Check out Compiler explorer [0].
What will it perform like? Use benchmarks [1] [2].
If it's not tested, it's not Engineered.
For tests, I strongly prefer GTest [3], for a fairly consistent API across benchmarking, testing, and mocking.
> there's a constant influx of new syntax and new concepts in C++
Yes, but you don't have to use all of it. You can still use older C++ if you really want to. I wouldn't recommend it though. I think the "sweet spot" right now is around C++17. It's got quite improved safety compared to "old" C++ (say... pre C++11) and is fairly easily understandable if you're coming from "old" C++.
[0]: https://gcc.godbolt.org/
[1]: https://quick-bench.com/
[2]: https://github.com/google/benchmark
[3]: https://github.com/google/googletest
-
Adding Automated Testing to My CLI Tool
I chose googletest for my project. Here's my commit. During Hacktoberfest, I explored a lot of repos that already had test cases in order to reduce the miserable side of software(crashing). I had previous experience with Jest.js, a JavaScript testing framework, but this was my first time using a testing framework in C++.
-
CLion agora é gratuito!
A versão inicial oferece suporte aos compiladores GNU Compiler Collection (GCC) e Clang e ao depurador GDB, LLDB e Google Test.
-
Why I Built a New C++ Build System
[dependency] https://github.com/google/googletest
-
The Two Factions of C++
> Googletest ... declares a direct dependency on an older LTS release of absl
Looking at the build configuration code:
https://github.com/google/googletest/blob/main/CMakeLists.tx...
it seems like the dependence on Abseil is optional. i.e. you can use googltest on its own. I wouldn't recommend it (I kinda like doctest), but still.
-
Getting started with GoogleTest and CMake
include(FetchContent) # Fetch GoogleTest FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 ) FetchContent_MakeAvailable(googletest) # Collect C++ source files recursively file(GLOB_RECURSE CXX_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") add_executable(unit_tests ${CXX_FILES}) # Link GoogleTest libraries target_link_libraries(unit_tests PRIVATE gtest_main ${PROJECT_NAME}_lib # Link to the main project library ) # Include directories (including where GoogleTest is built) target_include_directories(unit_tests PRIVATE ${gtest_SOURCE_DIR}/include) # Add include directories for tests to find headers target_include_directories(unit_tests PRIVATE ${PROJECT_SOURCE_DIR}/src) # Enable testing and discover tests # Discover and run tests include(GoogleTest) gtest_discover_tests(unit_tests)
-
Open Source C++ Stack
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).
What are some alternatives?
Choco - An open-source Java library for Constraint Programming
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)
biteopt - Derivative-Free Global Optimization Algorithm (C++, Python binding) - Continuous, Discrete, TSP, NLS, MINLP
CppUTest - CppUTest unit testing and mocking framework for C/C++
Decider - An Open Source .Net Constraint Programming Solver
doctest - The fastest feature-rich C++11/14/17/20/23 single-header testing framework