diff --git a/ut b/ut
index 7385556..902075a 100644
--- a/ut
+++ b/ut
@@ -1,30 +1,44 @@
//
-[](http://www.boost.org/LICENSE_1_0.txt)
-[](https://github.com/qlibs/ut/releases)
-[](https://godbolt.org/z/f3WPzK5xf)
-[](https://godbolt.org/z/MG5cjnsbM)
+[Overview](#Overview) / [Examples](#Examples) / [API](#API) / [FAQ](#FAQ)
----------------------------------------
+## UT: C++20 Unit-Testing library
-> "If you liked it then you `"should have put a"_test` on it", Beyonce rule
+ > "If you liked it then you `"should have put a"_test` on it", Beyonce rule
-## UT: C++20 minimal unit-testing library
+[](https://opensource.org/license/mit)
+[](https://github.com/qlibs/ut/releases)
+[](https://godbolt.org/z/3qT4vc9nY)
+[](https://godbolt.org/z/MG5cjnsbM)
-> https://en.wikipedia.org/wiki/Unit_testing
+ > https://en.wikipedia.org/wiki/Unit_testing
### Features
-- Single header (https://raw.githubusercontent.com/qliqbs/ut/main/ut)
- - Easy integration (see [FAQ](#faq))
+- Single header (https://raw.githubusercontent.com/qlibs/ut/main/ut - for integration see [FAQ](https://github.com/qlibs/.github/blob/main/profile/INTEGRATION.md))
- Compile-time first (executes tests at compile-time and/or run-time)
- Detects memory leaks and UBs at compile-time*
- Explicit by design (no implicit conversions, narrowing, epsilon-less floating point comparisions, ...)
@@ -33,9 +47,9 @@
- Compiles cleanly with ([`-fno-exceptions -fno-rtti -Wall -Wextra -Werror -pedantic -pedantic-errors`](https://godbolt.org/z/ceK6qsx68))
- Fast compilation times (see [compilation times](#comp))
- Fast run-time execution (see [performance](#perf))
-- Verifies itself upon include (aka run all tests via static_asserts but it can be disabled - see [FAQ](#faq))
+- Verifies itself upon include (can be disabled with `-DNTEST` - see [FAQ](https://github.com/qlibs/.github/blob/main/profile/NTEST.md))
-> Based on the `constexpr` ability of given compiler/standard
+> \*Based on the `constexpr` ability of given compiler/standard
### Requirements
@@ -43,7 +57,7 @@
---
-### Examples
+### Overview
> Hello world (https://godbolt.org/z/MG5cjnsbM)
@@ -213,6 +227,8 @@ int main() {
---
+### Examples
+
> Reflection integration (https://godbolt.org/z/v8GG4hfbW)
```cpp
@@ -291,20 +307,20 @@ time $CXX -x c++ -std=c++20 ut -c # 0.049s
[ut]: time $CXX benchmark.cpp -std=c++20 # 0m0.813s
[ut]: time $CXX benchmark.cpp -std=c++20 -DNTEST # 0m0.758s
-------------------------------------------------------------------------
-[ut] https://github.com/qlibs/ut/releases/tag/v2.1.2
+[ut] https://github.com/qlibs/ut/releases/tag/v2.1.3
```
### Performance
-> Benchmark - 100 tests, 1000 asserts (https://godbolt.org/z/6WzxvjEex)
+> Benchmark - 100 tests, 1000 asserts (https://godbolt.org/z/xKx45s4xq)
```cpp
time ./benchmark # 0m0.002s (-O3)
time ./benchmark # 0m0.013s (-g)
```
-> X86-64 assembly -O3 (https://godbolt.org/z/x6GYbs4hT)
+> X86-64 assembly -O3 (https://godbolt.org/z/rqbsafaE6)
```cpp
int main() {
@@ -329,7 +345,7 @@ main:
mov dword ptr [rax + 16], 6
lea rcx, [rip + template parameter object for fixed_string
mov qword ptr [rax + 24], rcx
- inc dword ptr [rip + ut::v2_1_1::cfg+52]
+ inc dword ptr [rip + ut::cfg+52]
mov rax, qword ptr [rip + ut::cfg+136]
mov ecx, dword ptr [rax + 8]
mov edx, dword ptr [rax + 92]
@@ -499,10 +515,13 @@ enum class mode {
compile_time
};
-template
-struct test_begin {
+template
+struct run {
+ T test{};
const char* file_name{};
- int line{}; const char* name{};
+ int line{};
+ const char* name{};
+ const char* filter{};
};
template
@@ -587,50 +606,31 @@ template inline auto cfg = default_cfg{};
```
```cpp
-#define UT 2'1'2 // Current library version (SemVer)
#define UT_RUN_TIME_ONLY // If defined tests will be executed
// at run-time + static_assert tests
#define UT_COMPILE_TIME_ONLY // If defined only compile-time tests
// will be executed
-#define NTEST // If defined it disables running
- // static_asserts tests for the UT library
- // (user tests are not affected)
+```
+
+```cpp
+UT_FILTER // If env is set only tests which match
+ // regex will be executed
```
---
### FAQ
-- Can I disable running tests at compile-time for faster compilation times?
-
- > When `NTEST` is defined static_asserts tests wont be executed upon inclusion.
- Note: Use with caution as disabling tests means that there are no guarantees upon inclusion that the given compiler/env combination works as expected.
-
-- How to integrate with CMake/CPM?
-
- ```
- CPMAddPackage(
- Name ut
- GITHUB_REPOSITORY qlibs/ut
- GIT_TAG v2.1.2
- )
- add_library(ut INTERFACE)
- target_include_directories(ut SYSTEM INTERFACE ${ut_SOURCE_DIR})
- add_library(ut::ut ALIAS ut)
- ```
-
- ```
- target_link_libraries(${PROJECT_NAME} ut::ut);
- ```
-
- Similar projects?
> [ut](https://github.com/boost-ext/ut), [catch2](https://github.com/catchorg/Catch2), [googletest](https://github.com/google/googletest), [gunit](https://github.com/cpp-testing/GUnit), [boost.test](https://www.boost.org/doc/libs/latest/libs/test/doc/html/index.html)