From 637dcabd633dd6570106754f4f17ae62d99422e9 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Mon, 15 Jun 2026 00:17:29 -0400 Subject: [PATCH] Quick little first release with some docs and a design that works. Need to use it in a project for real and improve it based on actual usage. --- README.md | 27 ++++++++++++++++++++++++++- src/fuc2.cpp | 4 ++-- tests/sample_failing.cpp | 13 ++++++++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d729788..7c94191 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,28 @@ # fuc2 -A very simple testing framework that rejects all previous testing designs and aims for plain wording, simple usability, and ease of debugging. You will never ask where a failure was ever again. \ No newline at end of file +A very simple testing framework that rejects all previous testing designs and aims for plain wording, simple usability, ease of debugging, __and designed for programmers only__. No weird testing verbiage, dogma, or strange latinized words to sound "sciency." The goal is to make writing tests less high-brow so normal people don't mind writing tests for their code. + +Another major goal of the project is to use plain regular old C++ that's very easy to debug. The +logging output clearly shows what tests runs, catches exceptions and reports them, and the API makes +it easy to set breakpoints on test functions. I know, revolutionary. + +## Quick Install + +Initial quick release. Look at the `meson.build` and the `tests/*` directory for a quicke example. +You buid it like this: + +```sh +./scripts/reset_build.sh +make +make test +``` + +On Windows it's: + +```shell +./scripts/reset_build.ps1 +make +make test +``` + +Instructions on how to use it in your own project coming soon. diff --git a/src/fuc2.cpp b/src/fuc2.cpp index 5e42b09..c2ed540 100644 --- a/src/fuc2.cpp +++ b/src/fuc2.cpp @@ -80,13 +80,13 @@ namespace fuc2 { } if(fail_count > 0) { - fmt::println("🚨 FAIL COUNT: {}", fail_count); + fmt::println("🚨🚨🚨🚨🚨 FAIL COUNT: {} in {}", fail_count, test_set.location.file_name()); for(auto& msg : errors) { fmt::println("---------\n{}", msg); } } else { - fmt::println("👍 ALL PASS"); + fmt::println("👍 ALL PASS: {}", test_set.location.file_name()); } return fail_count; diff --git a/tests/sample_failing.cpp b/tests/sample_failing.cpp index 46b29c6..d4cc7a3 100644 --- a/tests/sample_failing.cpp +++ b/tests/sample_failing.cpp @@ -25,11 +25,22 @@ namespace sample_failing { EQUAL(ages.size(), size_t(5), "wrong count"); } + void fail_blows_up() { + std::deque ages; + + auto runner = [&]() { + fmt::println("this will fail."); + }; + + BLOWS_UP(runner, "pop_front empty should crash"); + } + fuc2::Set TESTS{ - .name="std::deque basic operations", + .name="std::deque failing ops", .options={ .fail_fast=false }, .tests={ {"fail_pop_back", fail_push_pop_back}, + {"fail_blows_up", fail_blows_up}, } }; }