←back to thread

In Defense of C++

(dayvster.com)
185 points todsacerdoti | 2 comments | | HN request time: 0.001s | source
Show context
franky47 ◴[] No.45268116[source]
What’s a good (ie: opinionated) code formatter and unit test framework for C++ these days?

I just had a PR on an old C++ project, and spending 8 years in the web ecosystem have raised the bar around tooling expectations.

Rust is particularly sweet to work with in that regard.

replies(3): >>45268262 #>>45268281 #>>45268294 #
jonstewart ◴[] No.45268262[source]
Catch2 is great as a unit test framework.

Running unit tests with the address sanitizer and UB sanitizer enabled go a long way towards addressing most memory safety bugs. The kind of C++ you write then is a far cry from what the haters complain about with bad old VC6 era C++.

replies(1): >>45281578 #
1. einpoklum ◴[] No.45281578[source]
> Catch2 is great as a unit test framework.

It's "great" mainly in the sense of being very large, and making your code very lage - and slow to build. I would not recommend it unless you absolutely must have some particular feature not existing elsewhere.

Here's a long list of C++ unit testing frameworks: https://en.wikipedia.org/wiki/List_of_unit_testing_framework...

And you might consider:

* doctest: https://github.com/doctest/doctest

* snitch: https://github.com/snitch-org/snitch

* ut/micro-test: https://github.com/boost-ext/ut

replies(1): >>45292468 #
2. jonstewart ◴[] No.45292468[source]
I guess I consider it great in comparison to CppUnit, Boost Test, and Google Test. I also like that it incorporated nonius, that's a big win.