Skip to content

Commit 42a4a45

Browse files
committed
Switch To Simple Unit Testing Framework
1 parent bd9eb88 commit 42a4a45

File tree

7 files changed

+41
-59
lines changed

7 files changed

+41
-59
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,32 @@ jobs:
1414
gen_short_name: "vs17_2022"
1515
gen_cmake_name: "Visual Studio 17 2022"
1616

17+
- os: windows-2022
18+
arch: Win32
19+
gen_short_name: "vs17_2022"
20+
gen_cmake_name: "Visual Studio 17 2022"
21+
1722
- os: ubuntu-22.04
1823
arch: x64
1924
cc: gcc
2025
cxx: g++
26+
pkgs: gcc
27+
28+
- os: ubuntu-22.04
29+
arch: x32
30+
cc: gcc
31+
cxx: g++
32+
pkgs: gcc-multilib g++-multilib
33+
flags: "-m32"
2134

2235
- os: macos-12
2336
arch: x86_64
2437
gen: Xcode
2538

39+
- os: macos-12
40+
arch: arm64
41+
gen: Xcode
42+
2643
runs-on: ${{ matrix.os }}
2744
steps:
2845
- uses: actions/checkout@v4
@@ -32,27 +49,9 @@ jobs:
3249
- name: Install Deps (Linux)
3350
if: ${{ matrix.os == 'ubuntu-22.04' }}
3451
run: |
52+
sudo dpkg --add-architecture i386
3553
sudo apt-get update -y
36-
sudo apt-get install gcc libcriterion-dev cmake meson ninja-build libgit2-dev libffi-dev -y
37-
git clone https://github.com/Snaipe/Criterion.git --recursive
38-
cd Criterion
39-
meson setup -Dc_std=gnu11 --prefix /usr/local --libdir lib --buildtype plain --force-fallback-for libffi --wrap-mode nodownload build
40-
meson compile -C build
41-
sudo meson install -C build
42-
43-
- name: Install Deps (Windows)
44-
if: ${{ matrix.os == 'windows-2022' }}
45-
run: |
46-
choco install cmake meson ninja
47-
git clone https://github.com/Snaipe/Criterion.git --recursive
48-
cd Criterion
49-
meson setup -Dc_std=c11 --prefix /usr/local --libdir lib --buildtype plain --force-fallback-for libffi --wrap-mode nodownload build
50-
meson compile -C build
51-
meson install -C build
52-
53-
- name: Install Deps (MacOS)
54-
if: ${{ matrix.os == 'macos-12' }}
55-
run: brew install criterion
54+
sudo apt-get install ${{ matrix.pkgs }} cmake ninja-build -y
5655
5756
- name: Generate Build Files & Build (Linux)
5857
if: ${{ matrix.os == 'ubuntu-22.04' }}

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "test/minunit"]
2+
path = test/minunit
3+
url = https://github.com/csprite/minunit

CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,9 @@ if(WIN32 OR CYGWIN)
2424
endif()
2525

2626
if(FILESYSTEM_BUILD_TESTS)
27-
include(./FindCriterion.cmake)
28-
if(NOT CRITERION_FOUND)
29-
message(FATAL_ERROR "criterion not found")
30-
endif()
3127
project(FileSystem_Test CXX)
32-
add_executable(FileSystem_Test ${CMAKE_CURRENT_SOURCE_DIR}/src/test.cpp)
33-
target_include_directories(FileSystem_Test PUBLIC ${CRITERION_INCLUDE_DIRS})
34-
target_link_libraries(FileSystem_Test PUBLIC FileSystem ${CRITERION_LIBRARIES} criterion)
28+
add_executable(FileSystem_Test ${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp)
29+
target_include_directories(FileSystem_Test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/test/minunit/)
30+
target_link_libraries(FileSystem_Test PUBLIC FileSystem rt)
3531
endif()
3632

FindCriterion.cmake

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/test.cpp

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/minunit

Submodule minunit added at a058656

test/test.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "minunit/minunit.h"
2+
3+
MU_TEST(test_check) {
4+
mu_check(5 == 7);
5+
}
6+
MU_TEST_SUITE(test_suite) {
7+
MU_RUN_TEST(test_check);
8+
}
9+
10+
int main(int argc, char *argv[]) {
11+
MU_RUN_SUITE(test_suite);
12+
MU_REPORT();
13+
return MU_EXIT_CODE;
14+
}
15+

0 commit comments

Comments
 (0)