Skip to content

Enable C++17, Catch2 unit testing

Eidolon requested to merge cmake-enable-cxx into next
  • Enables C11 and C++17 build support in cmake
  • Adds a .clang-format with some reasonable settings for C++ code (don't apply them to C files though)
  • Redefines boolean to the C11 bool type for compatibility with C++. Also, deprecates boolean; use bool instead Yeah so it turns out C99/C11 _Bool is not necessarily compatible with C++ bool. Instead, the definition of boolean is changed up a bit and true/false are only defined in C compilation units, and we'll lean on conversion from C++ true/false to int32_t in C++ units.
  • Adds Catch2 unit testing. Add test sources to the srb2tests target from subdirectories to add new unit tests.
  • Adds the very first C++ code into SRB2, the srb2::Fixed class, pseudo-numeric type designed to make arithmetic on fixed point values easy. Comes with its very own unit tests. 🎉 Deferred to a later MR; needs battle-testing on real code.

You can run the tests after building the srb2tests target (builds by default) with the test target.

Edited by Eidolon

Merge request reports