Testing Guide
You cannot create new programs with splashkit-core as you do when using the traditional SplashKit
library. Instead, two programs are generated which can be configured to test its functionality:
sktest and skunit_tests. They are built with CMake using a preconfigured CMakeLists.txt file,
which builds the SplashKit library and both test programs.
Making Changes
Section titled “Making Changes”sktest is built with the .cpp files from splashkit-core/coresdk/src/test/. To add your own
tests, modify one or more of the files such as test_animation.cpp. Tests in sktest tend to focus
on demonstrating the output of functions, and require a human to validate that output. They are
written in standard C++ and can make use of SplashKit functions.
skunit_tests is built with the .cpp files from splashkit-core/coresdk/src/test/unit_tests/. When
it runs, all unit tests from all files in this folder are executed. Additional files can be added to
this folder if necessary. If adding a new file, copy the structure from one of the existing unit
test files. Unlike sktest, tests here need to be written as Catch2 test cases and
#include "catch.hpp" must be present in a given file for it to be compiled into skunit_tests.
These tests evaluate actual output against expected output and produce an error if a test fails. See
the
unit testing guide
for a more in depth explanation of how unit tests are written.
Building the test project
Section titled “Building the test project”If a change is made to the code, the build process needs to be run. This applies whether changes were made to coresdk files (such as adding new functions to SplashKit or changing existing code) or new tests were added to sktest or skunit_tests.
Install prerequisites
Section titled “Install prerequisites”Open a terminal and install prerequisites with these commands:
sudo apt-get updatesudo apt-get upgrade -ysudo apt-get install -y \git build-essential cmake g++ libpng-dev libcurl4-openssl-dev libsdl2-dev \libsdl2-mixer-dev libsdl2-gfx-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev \libmikmod-dev libbz2-dev libflac-dev libvorbis-dev libwebp-dev libfreetype6-devOpen the MINGW64 terminal and install prerequisites with these commands:
pacman -Syupacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-cmake mingw-w64-x86_64-makeBuild from the command line
Section titled “Build from the command line”cd projects/cmakecmake --preset Linuxcmake --build build/cd projects/cmakecmake --preset macOScmake --build build/cd projects/cmakecmake --preset Windowscmake --build build/Build in VS Code
Section titled “Build in VS Code”-
Install the CMake Tools extension from the VS Code extension browser or here.
-
Configure the extension:
Select${workspaceFolder}/projects/cmake/CMakeLists.txt

Select the Linux preset

Select the Default configure preset

In the CMake Tools extension click the button
next to Build and select all

Click the button
next to
Debug and select skunit_tests

-
Build test project:
In the CMake Tools extension, click the Build button. The test project will also be built when you refresh tests on the Testing tab of VS Code.

-
Install the CMake Tools extension from the VS Code extension browser or here.
-
Configure the extension:
Select${workspaceFolder}/projects/cmake/CMakeLists.txt

Select the macOS preset

Select the Default configure preset

In the CMake Tools extension click the button
next to Build and select all

Click the button
next to
Debug and select skunit_tests

-
Build test project:
In the CMake Tools extension, click Build. The test project will also be built when you refresh tests on the Testing tab of VS Code.

-
Install the CMake Tools extension from the VS Code extension browser or here.
-
Configure the extension:
Select${workspaceFolder}/projects/cmake/CMakeLists.txt

Select the Windows preset

Select the Default configure preset

In the CMake Tools extension click the button
next to Build and select all

Click the button
next to
Debug and select skunit_tests

-
Build test project:
In the CMake Tools extension, click Build. The test project will also be built when you refresh tests on the Testing tab of VS Code.

Running Tests
Section titled “Running Tests”After building the test programs, the compiled executables wiil be found in the splashkit-core/bin
directory. Running tests differs depending on if the tests are part of sktest or skunit_tests.
The sktest program
Section titled “The sktest program”To run sktest, open a terminal and enter:
cd splashkit-core/bin./sktestTo run sktest, open a terminal and enter:
cd splashkit-core/bin./sktestTo run sktest, open the MinGW terminal and enter:
cd splashkit-core/bin./sktest.exeA menu will be presented, showing a list of all the tests that are part of sktest. Select a test to run by entering the corresponding number.
--------------------- SplashKit Dev Tests--------------------- -1: Quit 0: Animations 1: Audio 2: Bundles 3: Camera 4: Geometry 5: Graphics 6: Input 7: Logging 8: Physics 9: Resources 10: Shape drawing 11: Sprite tests 12: Terminal 13: Text 14: Timers 15: Windows 16: Cave Escape 17: Web Server 18: RESTful Web Service 19: Network conversions 20: UDP Networking Test 21: TCP Networking Test 22: GPIO Tests 23: ADC Tests 24: Motor Driver Tests 25: Servo Driver Tests 26: Remote GPIO Tests 27: GPIO Tests - SPI 28: UI Tests--------------------- Select test to run:Unit tests
Section titled “Unit tests”Unit tests are built with the same process as sktest, but run with the skunit_tests program.
From the command line
Section titled “From the command line”-
It’s a good idea to run the unit tests in a random order so that you can confirm that they run indepedently of one another. If tests run in order, you may miss issues that occur when a test runs without the tests before it passing.
Terminal window cd ../../bin./skunit_tests --order randBy default, this will only show reports for failed tests. To show reports for successful tests as well, use the option
--success. More command line options can be found in Catch2’s documentation. -
If you want to run a specific test, or group of tests, you can do so:
Terminal window ./skunit_tests <test spec>The
test speccan be a test name or tags and supports wildcards. For example,*string*would run all of the tests with “string” in the name.
-
It’s a good idea to run the unit tests in a random order so that you can confirm that they run indepedently of one another. If tests run in order, you may miss issues that occur when a test runs without the tests before it passing.
Terminal window cd ../../bin./skunit_tests --order randBy default, this will only show reports for failed tests. To show reports for successful tests as well, use the option
--success. More command line options can be found in Catch2’s documentation. -
If you want to run a specific test, or group of tests, you can do so:
Terminal window ./skunit_tests <test spec>The
test speccan be a test name or tags and supports wildcards. For example,*string*would run all of the tests with “string” in the name.
-
It’s a good idea to run the unit tests in a random order so that you can confirm that they run indepedently of one another. If tests run in order, you may miss issues that occur when a test runs without the tests before it passing.
Terminal window cd ../../bin./skunit_tests.exe --order randBy default, this will only show reports for failed tests. To show reports for successful tests as well, use the option
--success. More command line options can be found in Catch2’s documentation. -
If you want to run a specific test, or group of tests, you can do so:
Terminal window ./skunit_tests.exe <test spec>The
test speccan be a test name or tags and supports wildcards. For example,*string*would run all of the tests with “string” in the name.
In VS Code
Section titled “In VS Code”You can run tests from the Testing tab in VS Code if you’ve set up the CMake Tools extension as
outlined above ![]()
- Running all tests:
Click Run Tests. Each test will be run and the status of each can be seen in the test list after a test runs.

- Running a specific test:
Click Run Test next to any test on the test list to run it

