Add ut to project and create tests for each of the algorithms.
Add https://github.com/boost-ext/ut to the project to test it, and lead to having a CI run on it like it does for J. This will require compiler upgrades on to at least (GCC-9+, Clang-9.0+, Apple Clang-11.0.0+, MSVC-2019+*, Clang-cl-9.0+) just for the tests to build. Though the algorithm.hpp should still include just fine, into older compilers, Until we add newer standard code to it.
- [x] add .gitignore (I guess we did have one already, I copied the one from the j project as it filters more things out)
- [x] ~~add
static_assert(sizeof...(Is) != 0U);to transform and find. Since it's an error to not pass at least 1 iterator to these functions.~~ Turns out it's okay to only have 1 range if the op or pred is coded to handle one range. - [x] set library to c++20 (The .hpp files should still work on c++17 till we add c++20 code) (required by ut)
- [x] add ut to cmake
- [x] add test executable
- [x] add tests for algorithm.hpp
- [x] add some variadic operations. Such as:
- [x] plus, multiply, to test transform,
- [x] equal_to, not_equal_to for testing find, found
- [x] make_signed, make_unsigned these take a op and values change them to all signed or all unsigned and then pass to the op and return the value.
- [x] make sure to have constexpr tests to make sure the code works at constexpr time.
- [x] transform overload that takes a r-value for output range so I can pass a std::array and it returns the transformed version.
- [x] iota, I know we are getting a views::iota but it's only in one compiler as of now.
- [x] add some variadic operations. Such as:
- [x] add test executable to ctest with add_test
- [x] add compiler warnings to test executable.
- [x] import .clang-format, I copied the one from the j project
- [x] appveyor.yml - I added this as a CI option. Though you might wanna set up your own CI like you did with j. Appveyor has to update gcc, ninja and cmake every time it runs. :P And I just did linux we probably wanna have build scripts for windows and mac. I created this with the appveyor website and exported the script to a yml. https://ci.appveyor.com/project/Sebanisu/an-algorithm-library
- [x] Build on MSVC 2019 - is the fastest because appveyor keeps MSVC up to date so we don't need to download updates.
- [x] Build on Clang 12
- [x] Build on GCC 10.2
I added extra functions to algorithm_test.cpp as I didn't want to add new functions to algorithm.h without checking with you first. These extra functions might be used in tests but might not be needed in the aal library.
resolves: https://github.com/codereport/An-Algorithm-Library/issues/3
I think this is a good start. :)
~~ninja -C build test is working in my other project. And I based my cmake code on that and this one it isn't working. So something is off in my cmake.~~
fixed enable_testing() needs to be ran on the root CMakeLists.txt
I found https://cliutils.gitlab.io/modern-cmake/chapters/testing.html so I added a some if statements in https://github.com/codereport/An-Algorithm-Library/pull/7/commits/adb223c8dbad792108a7ec3f90f4844b4efcbd51
Without the if statements the cTest was still looking for the tests even if they weren't built. So j's tests would show failed because it would try to run An-Algorithm-Library's tests.
https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_NAME.html https://cmake.org/cmake/help/latest/variable/PROJECT_NAME.html
Appveyor's clang support might be limited till I solve a build script issue. https://github.com/Sebanisu/ToolsLibrary/issues/6
Some c++20 features require libc++ to work like std::span. You might need to disable building on clang if you use too many new features of c++20.
MSVC has a bug with c++20 templated lambdas opened a ticket on microsoft https://github.com/Sebanisu/ToolsLibrary/issues/4 though it might not be an issue here.
I was able to get it to build on clang12 with libc++ Might not be the best build script but it's working :)