fit is a C++11 header-only library that provides utilities for functions and function objects. Fit is divided into three components:
- Function Adapters: These take functions and return a new function that provides an additional capability to the previous function.
- Functions: These return functions that achieve a specific purpose.
- Utilities: These are general utilities that are useful when defining or using functions.
The main block is FIT block, which is generated from this github repo.
Calculate giving the coordinates, the angles and sides length of a polygon between 3 and 10 vertex. To start, create a project, open the example and execute:
Note: If you are using CLANG you may need to use clang --version
to check it’s higher than 3.5.
~$ bii init fit
~$ cd fit
~/fit$ bii open examples/fit
~/fit$ bii build
~/fit$ #execute the tests on bin folder
Now let’s check the code, open one of the test files (test/always.cpp) :
#include <fit/always.h>
#include <memory>
#include "test.h"
FIT_TEST_CASE()
{
static const int ten = 10;
FIT_STATIC_TEST_CHECK(fit::always(ten)(1,2,3,4,5) == 10);
FIT_TEST_CHECK( fit::always(ten)(1,2,3,4,5) == 10 );
}
Execute the binary and this is how the output looks like:
~/fit$ bin/examples_fit_test_always
**CORRECT** fit::always(ten)(1,2,3,4,5) == 10
The output is what always.cpp file is testing, if successes it writes CORRECT, if it doesn’t it writes FAILED.
Didn’t work? No problem, read or contact us in the biicode forum.
Any suggestion or feedback? Write us! It is very welcomed :)