pest/1.0.1

[brief]

pest is macro free otherwise simplistic c++17 unit testing

antibloat & turbo simplistic header only cxx unit testing & benchmarking thingy.

implemented this because a hackable solution for unit testing was needed not causing excessive compile times once you have more than one assertion.

pest includes a xoshiro prng and a zipfian distribution helper class:

requires

examples

unit tests ( using emptyspace::pest )

source file ...

#include <pest/pest.hxx>

namespace {

emptyspace::pest::suite basic( "pest self test", []( auto& test ) {
  using namespace emptyspace::pest;

  test( "true equal_to true", []( auto& expect ) {
    expect( true, equal_to( true ) );
  } );

  test( "vector<> equal_to initializer_list<>", []( auto& expect ) {
    auto const inputs = std::vector<int>{ 3, 4, 7 };
    expect( inputs, equal_to( { 3, 4, 7 } ) );
  } );
} );

} // namespace

int main() {
  basic( std::clog );
  return 0;
}

... and example output

# assuming the example from above is in `example.cxx`
pest $ clang++10 -I. -std=c++17 example.cxx -o ex
pest $ ./ex
[suite <pest self test> | true equal_to true]
[suite <pest self test> | vector<> equal_to initializer_list<>]
[suite <pest self test> | summary]
  total assertions failed = 0
  total assertions pass = 2
  total assertions skipped = 0
  total uncaught exceptions = 0
  total tests = 2

benchmarks ( using emptyspace::pnch )

suppose we want to benchmark the strftime function ...

#include <pest/pnch.hxx>
#include <ctime>

int main() {
  emptyspace::pnch::config cfg;
  std::size_t n = 0;
  char buffer[128];
  cfg.run(
         "strftime",
         [&]() {
           auto stamp1 = std::chrono::system_clock::now();
           auto epoch = std::chrono::system_clock::to_time_t( stamp1 );
           auto gmtime = std::gmtime( &epoch );
           n += std::strftime( buffer, 64, "%Y.%m.%d:%T.", gmtime );
         } )
      .touch( n )
      .report_to( std::cerr );
      
  return n > 0;
}

... could lead to the following output

[benchmark | strftime]
  stats/total = 2.27702e+09
  stats/average = 990.007
  stats/stddev = 7.18419

development & packaging

build2 is used for life cycle management. for using without build2 just drop the header into your project.

cloning the repository and running the test driver test/unit/driver.cxx

$ git clone https://github.com/stackless-goto/pest
$ cd pest
$ bdep init -C @clang10 cc config.cxx=clang++10
$ bdep test
test tests/unit/testscript{testscript}@../pest-clang10/pest/tests/unit/ ../pest-clang10/pest/tests/unit/exe{driver}

declaring pest as dependency in a build2 project:

TODO

references

similar libraries. might be better suited ...

unit test helpers

benchmark helpers

mirrors

license

choose between UNLICENSE or LICENSE freely. zipfian and xoshiro are derived work and therefore -- as indicated in the corresponding source files -- MIT licensed.

support and blame-game

magenbluten < mb [at] 64k.by > :: https://64k.by

version 1.0.1
license public domain
repository https://pkg.cppget.org/1/stable
download pest-1.0.1.tar.gz
sha256 cc4e2c83c78cd5d86d6412c6cc29558e17304f2b93728978719da6a9d42d9fde
project pest
url hub.darcs.net/magenbluten/pest

Requires (1)

c++17

Reviews

fail 0
pass 1

Builds

toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-static_O3
timestamp 2026-01-03 02:53:20 UTC (02:32:18 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14
timestamp 2026-01-03 02:50:33 UTC (02:35:05 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-ndebug_O3
timestamp 2026-01-03 02:49:57 UTC (02:35:42 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_14-O3
timestamp 2026-01-03 02:44:07 UTC (02:41:31 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10-static_O2
timestamp 2026-01-02 12:23:36 UTC (17:02:02 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10-O2
timestamp 2026-01-02 12:23:25 UTC (17:02:14 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_18_llvm_msvc_17.10
timestamp 2026-01-02 12:19:54 UTC (17:05:44 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_12-bindist
timestamp 2026-01-02 12:18:01 UTC (17:07:38 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64
timestamp 2026-01-02 12:10:51 UTC (17:14:47 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64-static_O2
timestamp 2026-01-02 12:10:15 UTC (17:15:24 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-w64-mingw32
tgt config windows_10-gcc_13.2_mingw_w64-O2
timestamp 2026-01-02 12:07:51 UTC (17:17:48 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8-static_O2
timestamp 2026-01-02 12:05:33 UTC (17:20:05 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-clang_17_msvc_msvc_17.10
timestamp 2026-01-02 12:04:17 UTC (17:21:22 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8
timestamp 2026-01-02 12:02:48 UTC (17:22:51 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.8-O2
timestamp 2026-01-02 12:02:47 UTC (17:22:51 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18-static_O3
timestamp 2026-01-02 11:59:35 UTC (17:26:03 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_ubuntu_24.04-gcc_13-bindist
timestamp 2026-01-02 11:57:41 UTC (17:27:58 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-O3
timestamp 2026-01-02 11:57:34 UTC (17:28:05 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18
timestamp 2026-01-02 11:57:01 UTC (17:28:38 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-static_O3
timestamp 2026-01-02 11:56:26 UTC (17:29:12 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14-ndebug_O3
timestamp 2026-01-02 11:56:15 UTC (17:29:24 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_14
timestamp 2026-01-02 11:55:49 UTC (17:29:49 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd14.1
tgt config freebsd_14-clang_18-O3
timestamp 2026-01-02 11:54:27 UTC (17:31:11 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-freebsd13.3
tgt config freebsd_13-clang_17
timestamp 2026-01-02 11:51:53 UTC (17:33:45 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_17_libc++
timestamp 2026-01-02 11:46:12 UTC (17:39:26 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_17
timestamp 2026-01-02 11:43:48 UTC (17:41:50 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-gcc_13.1
timestamp 2026-01-02 11:43:15 UTC (17:42:24 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-static_O3
timestamp 2026-01-02 11:27:30 UTC (17:58:09 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-O3
timestamp 2026-01-02 11:26:49 UTC (17:58:50 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18_libc++
timestamp 2026-01-02 11:26:15 UTC (17:59:23 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18-O3
timestamp 2026-01-02 11:26:13 UTC (17:59:26 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18-static_O3
timestamp 2026-01-02 11:25:36 UTC (18:00:02 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_18
timestamp 2026-01-02 11:24:59 UTC (18:00:39 hours ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_fedora_40-gcc_14-bindist
timestamp 2026-01-01 11:10:21 UTC (01 18:15:18 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_17
timestamp 2026-01-01 10:24:36 UTC (01 19:01:03 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-clang_17_libc++
timestamp 2026-01-01 10:24:02 UTC (01 19:01:36 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target aarch64-linux-gnu
tgt config linux_debian_12-gcc_13
timestamp 2026-01-01 10:22:20 UTC (01 19:03:18 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10-O2
timestamp 2025-12-25 11:51:28 UTC (08 17:34:11 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10-static_O2
timestamp 2025-12-25 11:50:58 UTC (08 17:34:40 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-microsoft-win32-msvc14.3
tgt config windows_10-msvc_17.10
timestamp 2025-12-25 11:50:37 UTC (08 17:35:01 days ago)
result error (update) | log | rebuild
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18-O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_debian_12-clang_18_libc++-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-linux-gnu
tgt config linux_fedora_39-gcc_13-bindist
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin22.5.0
tgt config macos_13-clang_15.0
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0-O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-clang_15.0-static_O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew-O3
result unbuilt
toolchain public-0.17.0
target x86_64-apple-darwin23.5.0
tgt config macos_14-gcc_14_homebrew-static_O3
result unbuilt