Comments (1)
I think there are a number of considerations with choosing a testing framework for this repository that are more important than for other projects:
- It needs to be very easy to create tests, since this is for learning.
- The tests need to be easy to read, for the reasons mentioned by Cclaus to teach readers how to call the algorithm in a broader context.
- The tests need to be easy to build. Currently the only dependencies of this project are CMake and the optional Doxygen dependency. This is a big plus for learners, who are often scared away from trying to build+run projects by the difficult process of building it and its dependencies. This is something that most other repositories in TheAlgorithms don't need to consider as much (e.g. because it's not a compiled language).
- [Optional] We could choose to use the same testing framework as the C algorithms repository. If people contribute to both of these repositories, they'd only need to learn about one testing framework. That limits the available testing frameworks to those that support both languages. I don't have a lot of experience with that though.
Things that are perhaps less important for this repository are:
- Feature completeness. We won't need death tests or anything advanced like that. And in fact, usage of advanced features will make it harder to read the tests so even if they are supported by the testing framework, so we may want to discourage usage of advanced features.
- Brevity. Since these algorithms are quite self-contained, it makes sense for the tests to be self-contained too. Makes it easier to read the tests as well. If that comes at the cost of repeating code used to create fixtures or something, that is acceptable. Of course, this should hopefully not go at the cost of readability.
Several good candidates:
- Catch: Nice that it's header-only and single file, so it's easy to build, we could just include it in the repository even if that's really a problem. The syntax is quite simple and easy to read.
- GoogleTest: Serious candidate purely by virtue of being probably the most commonly used testing framework nowadays. If you're not using advanced features, the syntax is also really simple.
- Boost Test: Very similar in usage to GoogleTest, but not quite as popular in the real world. Maybe because it's a bit harder to set up the build system for, in my experience. Once the CMake is written it should be easy enough to build though.
One candidate I'd like to discourage for this repository is CppUnit. Although the framework is quite commonly used and the way of writing tests is very similar to how it's used in the common framework JUnit, the tests are pretty hard to read and verbose. It's hard to learn since there is more bookkeeping to it.
from c-plus-plus.
Related Issues (20)
- [FEATURE] Bisection method HOT 5
- Add Radix sort Algorithm HOT 3
- want to add Bankers algorithm HOT 5
- [FEATURE]:Print all the subsets of an array HOT 4
- [FEATURE] Reduce space complexity of 0-1 Knapsack problem HOT 7
- [FEATURE] Addition of S-AES (Simplified AES) cipher in ciphers directiory. HOT 3
- [FEATURE] Add 0-1 BFS in Graph section HOT 3
- [FEATURE] Addition of Graph Coloring Problem in Graphs directory HOT 2
- [FEATURE] Add implementation of Floyd–Warshall algorithm in Graph section HOT 3
- MorrisPreOrder Traversal HOT 2
- Implementing Priority Queue HOT 2
- To Add various OS algorithms in C++ HOT 2
- [Addition of standard greedy algorithms to greedy algorithm file] HOT 3
- Wanted to add a separate section for trees question HOT 3
- feat: Wanted to add an algorithm for bfs(queue) traversal for a binary tree. HOT 2
- SRTF implementation HOT 2
- [BUG] There is a problem with the wildcard_matching algorithm implementation. HOT 2
- [FEATURE] Remove one of two same problems "Subset Sum" in Backtracking (C++). HOT 2
- [BUG] timsort - std::bad_array_new_length
- [BUG] error: reference to 'queue' is ambiguous
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-plus-plus.