aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.clang-tidy4
-rw-r--r--test/meson.build34
-rw-r--r--test/test_cursor.c4
-rw-r--r--test/test_gl_free_unrealized.c14
-rw-r--r--test/test_gl_hints.c3
-rw-r--r--test/test_stub_hints.c3
-rw-r--r--test/test_timer.c2
7 files changed, 34 insertions, 30 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy
index 8ecb90f..c88c7b3 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -1,10 +1,12 @@
-# Copyright 2020-2023 David Robillard <d@drobilla.net>
+# Copyright 2020-2024 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: 0BSD OR ISC
Checks: >
+ -bugprone-multi-level-implicit-pointer-conversion,
-bugprone-suspicious-include,
-cert-err33-c,
-cert-err34-c,
+ -clang-analyzer-optin.core.EnumCastOutOfRange,
-google-runtime-references,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
diff --git a/test/meson.build b/test/meson.build
index f8d2fd1..791cf04 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -39,10 +39,7 @@ if not meson.is_subproject() and get_option('lint')
endif
endif
-basic_exclusive_tests = [
- 'local_copy_paste',
- 'remote_copy_paste',
-]
+basic_exclusive_tests = []
basic_tests = [
'cursor',
@@ -53,7 +50,6 @@ basic_tests = [
'strerror',
'stub',
'stub_hints',
- 'timer',
'update',
'view',
'world',
@@ -69,6 +65,11 @@ gl_tests = [
vulkan_tests = ['vulkan']
+if with_timers
+ basic_exclusive_tests += ['local_copy_paste', 'remote_copy_paste']
+ basic_tests += ['timer']
+endif
+
includes = [
'.',
'../include',
@@ -152,7 +153,7 @@ if vulkan_dep.found()
endforeach
endif
-unified_args = []
+unified_args = core_args
unified_deps = [core_deps]
if cairo_dep.found()
unified_args += ['-DWITH_CAIRO']
@@ -174,9 +175,9 @@ if host_machine.system() == 'darwin'
objcpp = meson.get_compiler('objcpp')
- objcpp_args = []
+ objcpp_unified_args = unified_args
if objcpp.get_id() == 'clang'
- objcpp_args += [
+ objcpp_unified_args += [
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-deprecated-declarations',
@@ -184,7 +185,7 @@ if host_machine.system() == 'darwin'
]
endif
- unified_args += objcpp.get_supported_arguments(test_cpp_args + objcpp_args)
+ objcpp_unified_args = objcpp.get_supported_arguments(objcpp_unified_args)
test(
'inline_objcpp',
@@ -193,23 +194,22 @@ if host_machine.system() == 'darwin'
'test_inline_objcpp.mm',
dependencies: unified_deps,
include_directories: include_directories(includes),
- objcpp_args: unified_args,
+ objcpp_args: objcpp_unified_args,
),
suite: 'unit',
)
elif is_variable('cpp')
- unified_args = []
-
+ cpp_unified_args = unified_args
if cpp.get_id() == 'clang'
- unified_args += [
+ cpp_unified_args += [
'-Wno-old-style-cast',
'-Wno-switch-default',
'-Wno-switch-enum',
'-Wno-unused-macros', # Mac
]
elif cpp.get_id() == 'gcc'
- unified_args += [
+ cpp_unified_args += [
'-Wno-conditionally-supported',
'-Wno-old-style-cast',
'-Wno-switch-default',
@@ -217,17 +217,19 @@ elif is_variable('cpp')
'-Wno-useless-cast',
]
elif cpp.get_id() == 'msvc'
- unified_args += [
+ cpp_unified_args += [
'/wd4464', # relative include path contains '..'
]
endif
+ cpp_unified_args = cpp.get_supported_arguments(cpp_unified_args)
+
test(
'inline_cpp',
executable(
'test_inline_cpp',
'test_inline_cpp.cpp',
- cpp_args: test_cpp_args + unified_args,
+ cpp_args: cpp_unified_args,
dependencies: unified_deps,
include_directories: include_directories(includes),
),
diff --git a/test/test_cursor.c b/test/test_cursor.c
index 11a52d7..9b0fa66 100644
--- a/test/test_cursor.c
+++ b/test/test_cursor.c
@@ -63,7 +63,9 @@ main(int argc, char** argv)
// Change the cursor, updating each time
assert(puglSetCursor(test.view, (PuglCursor)-1));
for (unsigned i = 0; i < (unsigned)PUGL_CURSOR_ALL_SCROLL; ++i) {
- assert(!puglSetCursor(test.view, (PuglCursor)i));
+ const PuglStatus st = puglSetCursor(test.view, (PuglCursor)i);
+
+ assert(!st || st == PUGL_UNSUPPORTED);
assert(!puglUpdate(test.world, 0.1));
}
diff --git a/test/test_gl_free_unrealized.c b/test/test_gl_free_unrealized.c
index 82fc18b..ba0d895 100644
--- a/test/test_gl_free_unrealized.c
+++ b/test/test_gl_free_unrealized.c
@@ -1,4 +1,4 @@
-// Copyright 2022 David Robillard <d@drobilla.net>
+// Copyright 2022-2024 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
/*
@@ -9,8 +9,6 @@
#undef NDEBUG
-#include "test_utils.h"
-
#include "pugl/gl.h"
#include "pugl/pugl.h"
@@ -18,16 +16,14 @@
#include <stddef.h>
typedef struct {
- PuglWorld* world;
- PuglView* view;
- PuglTestOptions opts;
+ PuglWorld* world;
+ PuglView* view;
} PuglTest;
int
-main(int argc, char** argv)
+main(void)
{
- PuglTest test = {
- puglNewWorld(PUGL_PROGRAM, 0), NULL, puglParseTestOptions(&argc, &argv)};
+ PuglTest test = {puglNewWorld(PUGL_PROGRAM, 0), NULL};
// Set up view
test.view = puglNewView(test.world);
diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c
index 16b51c5..250136a 100644
--- a/test/test_gl_hints.c
+++ b/test/test_gl_hints.c
@@ -85,7 +85,8 @@ main(void)
assert(puglGetViewHint(view, PUGL_SWAP_INTERVAL) != PUGL_DONT_CARE);
assert(puglGetViewHint(view, PUGL_RESIZABLE) != PUGL_DONT_CARE);
assert(puglGetViewHint(view, PUGL_IGNORE_KEY_REPEAT) != PUGL_DONT_CARE);
- assert(puglGetViewHint(view, PUGL_REFRESH_RATE) != PUGL_DONT_CARE);
+ assert(puglGetViewHint(view, PUGL_REFRESH_RATE) == PUGL_DONT_CARE ||
+ puglGetViewHint(view, PUGL_REFRESH_RATE) > 0);
// Tear down
puglFreeView(view);
diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c
index 4c9d0c4..b7d54e3 100644
--- a/test/test_stub_hints.c
+++ b/test/test_stub_hints.c
@@ -77,7 +77,8 @@ main(void)
assert(puglGetViewHint(view, PUGL_ALPHA_BITS) != PUGL_DONT_CARE);
assert(puglGetViewHint(view, PUGL_RESIZABLE) != PUGL_DONT_CARE);
assert(puglGetViewHint(view, PUGL_IGNORE_KEY_REPEAT) != PUGL_DONT_CARE);
- assert(puglGetViewHint(view, PUGL_REFRESH_RATE) != PUGL_DONT_CARE);
+ assert(puglGetViewHint(view, PUGL_REFRESH_RATE) == PUGL_DONT_CARE ||
+ puglGetViewHint(view, PUGL_REFRESH_RATE) > 0);
// Tear down
puglFreeView(view);
diff --git a/test/test_timer.c b/test/test_timer.c
index 1c9f281..405a5c2 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <stdio.h>
-#define NUM_TIMERS 4U // NOLINT(modernize-macro-to-enum)
+#define NUM_TIMERS 4U // NOLINT(*-macro-to-enum)
#ifdef __APPLE__
static const double timeout = 1 / 60.0;