1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
|
From 0d3e1b3923a1fac80e9d75d8b5e33cd36f4fe659 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 31 May 2024 09:03:22 -0700
Subject: [PATCH] bindings: cxx: Migrate C++ tests to use Catch2 v3
Catch2 v3.x has API changes which needs to be addressed
in the tests themselves, hence this changeset is to fix
those.
Upstream-Status: Submitted [https://lore.kernel.org/linux-gpio/20240531184223.3949069-1-raj.khem@gmail.com/T/#u]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/cxx/tests/Makefile.am | 2 +-
bindings/cxx/tests/gpiod-cxx-test-main.cpp | 3 +--
bindings/cxx/tests/helpers.hpp | 8 +++---
bindings/cxx/tests/tests-chip-info.cpp | 30 ++++++++++-----------
bindings/cxx/tests/tests-chip.cpp | 14 +++++-----
bindings/cxx/tests/tests-edge-event.cpp | 2 +-
bindings/cxx/tests/tests-info-event.cpp | 2 +-
bindings/cxx/tests/tests-line-config.cpp | 2 +-
bindings/cxx/tests/tests-line-info.cpp | 22 +++++++--------
bindings/cxx/tests/tests-line-request.cpp | 16 +++++------
bindings/cxx/tests/tests-line-settings.cpp | 2 +-
bindings/cxx/tests/tests-line.cpp | 2 +-
bindings/cxx/tests/tests-misc.cpp | 2 +-
bindings/cxx/tests/tests-request-config.cpp | 10 +++----
configure.ac | 4 +--
15 files changed, 60 insertions(+), 61 deletions(-)
diff --git a/bindings/cxx/tests/Makefile.am b/bindings/cxx/tests/Makefile.am
index fbf80a1..d9284da 100644
--- a/bindings/cxx/tests/Makefile.am
+++ b/bindings/cxx/tests/Makefile.am
@@ -4,7 +4,7 @@
AM_CXXFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include
AM_CXXFLAGS += -I$(top_srcdir)/tests/gpiosim/
AM_CXXFLAGS += -Wall -Wextra -g -std=gnu++17 $(CATCH2_CFLAGS)
-AM_LDFLAGS = -pthread
+AM_LDFLAGS = -pthread $(CATCH2_LIBS)
LDADD = $(top_builddir)/bindings/cxx/libgpiodcxx.la
LDADD += $(top_builddir)/tests/gpiosim/libgpiosim.la
diff --git a/bindings/cxx/tests/gpiod-cxx-test-main.cpp b/bindings/cxx/tests/gpiod-cxx-test-main.cpp
index 11bf8e5..ec48286 100644
--- a/bindings/cxx/tests/gpiod-cxx-test-main.cpp
+++ b/bindings/cxx/tests/gpiod-cxx-test-main.cpp
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2017-2021 Bartosz Golaszewski <bartekgola@gmail.com>
-#define CATCH_CONFIG_MAIN
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
diff --git a/bindings/cxx/tests/helpers.hpp b/bindings/cxx/tests/helpers.hpp
index 62d9827..62bbdf5 100644
--- a/bindings/cxx/tests/helpers.hpp
+++ b/bindings/cxx/tests/helpers.hpp
@@ -4,13 +4,13 @@
#ifndef __GPIOD_CXX_TEST_HELPERS_HPP__
#define __GPIOD_CXX_TEST_HELPERS_HPP__
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <regex>
#include <string>
#include <sstream>
#include <system_error>
-class system_error_matcher : public Catch::MatcherBase<::std::system_error>
+class system_error_matcher : public Catch::Matchers::MatcherBase<::std::system_error>
{
public:
explicit system_error_matcher(int expected_errno);
@@ -21,7 +21,7 @@ private:
::std::error_condition _m_cond;
};
-class regex_matcher : public Catch::MatcherBase<::std::string>
+class regex_matcher : public Catch::Matchers::MatcherBase<::std::string>
{
public:
explicit regex_matcher(const ::std::string& pattern);
@@ -33,7 +33,7 @@ private:
::std::string _m_repr;
};
-template<class T> class stringify_matcher : public Catch::MatcherBase<T>
+template<class T> class stringify_matcher : public Catch::Matchers::MatcherBase<T>
{
public:
explicit stringify_matcher(const ::std::string& expected) : _m_expected(expected)
diff --git a/bindings/cxx/tests/tests-chip-info.cpp b/bindings/cxx/tests/tests-chip-info.cpp
index 717c387..2c54f53 100644
--- a/bindings/cxx/tests/tests-chip-info.cpp
+++ b/bindings/cxx/tests/tests-chip-info.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include <sstream>
@@ -24,12 +24,12 @@ TEST_CASE("chip_info properties can be read", "[chip-info][chip]")
SECTION("get chip name")
{
- REQUIRE_THAT(info.name(), Catch::Equals(sim.name()));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name()));
}
SECTION("get chip label")
{
- REQUIRE_THAT(info.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar"));
}
SECTION("get num_lines")
@@ -52,12 +52,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]")
{
auto copy(info);
- REQUIRE_THAT(copy.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(copy.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(copy.num_lines() == 4);
- REQUIRE_THAT(info.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(info.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(info.num_lines() == 4);
}
@@ -67,12 +67,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]")
copy = info;
- REQUIRE_THAT(copy.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(copy.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(copy.num_lines() == 4);
- REQUIRE_THAT(info.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(info.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(info.num_lines() == 4);
}
@@ -80,8 +80,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]")
{
auto moved(std::move(info));
- REQUIRE_THAT(moved.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(moved.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(moved.num_lines() == 4);
}
@@ -91,8 +91,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]")
moved = ::std::move(info);
- REQUIRE_THAT(moved.name(), Catch::Equals(sim.name()));
- REQUIRE_THAT(moved.label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name()));
+ REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar"));
REQUIRE(moved.num_lines() == 4);
}
}
diff --git a/bindings/cxx/tests/tests-chip.cpp b/bindings/cxx/tests/tests-chip.cpp
index c5ec19b..1ab7add 100644
--- a/bindings/cxx/tests/tests-chip.cpp
+++ b/bindings/cxx/tests/tests-chip.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include <sstream>
#include <system_error>
@@ -48,9 +48,9 @@ TEST_CASE("chip constructor works", "[chip]")
.build();
::gpiod::chip first(sim.dev_path());
- REQUIRE_THAT(first.get_info().label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(first.get_info().label(), Catch::Matchers::Equals("foobar"));
::gpiod::chip second(::std::move(first));
- REQUIRE_THAT(second.get_info().label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(second.get_info().label(), Catch::Matchers::Equals("foobar"));
}
}
@@ -70,9 +70,9 @@ TEST_CASE("chip operators work", "[chip]")
::gpiod::chip moved_chip(moved_sim.dev_path());
- REQUIRE_THAT(chip.get_info().label(), Catch::Equals("foobar"));
+ REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("foobar"));
chip = ::std::move(moved_chip);
- REQUIRE_THAT(chip.get_info().label(), Catch::Equals("moved"));
+ REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("moved"));
}
SECTION("boolean operator")
@@ -94,7 +94,7 @@ TEST_CASE("chip properties can be read", "[chip]")
SECTION("get device path")
{
- REQUIRE_THAT(chip.path(), Catch::Equals(sim.dev_path()));
+ REQUIRE_THAT(chip.path(), Catch::Matchers::Equals(sim.dev_path()));
}
SECTION("get file descriptor")
@@ -169,7 +169,7 @@ TEST_CASE("stream insertion operator works for chip", "[chip]")
"\", label=\"foobar\", num_lines=4))";
buf << chip;
- REQUIRE_THAT(buf.str(), Catch::Equals(expected.str()));
+ REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str()));
}
SECTION("closed chip")
diff --git a/bindings/cxx/tests/tests-edge-event.cpp b/bindings/cxx/tests/tests-edge-event.cpp
index 19a6ab3..db387be 100644
--- a/bindings/cxx/tests/tests-edge-event.cpp
+++ b/bindings/cxx/tests/tests-edge-event.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <chrono>
#include <gpiod.hpp>
#include <sstream>
diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp
index 21c0ef0..f7ae309 100644
--- a/bindings/cxx/tests/tests-info-event.cpp
+++ b/bindings/cxx/tests/tests-info-event.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <chrono>
#include <filesystem>
#include <gpiod.hpp>
diff --git a/bindings/cxx/tests/tests-line-config.cpp b/bindings/cxx/tests/tests-line-config.cpp
index 5e439a1..2f510fb 100644
--- a/bindings/cxx/tests/tests-line-config.cpp
+++ b/bindings/cxx/tests/tests-line-config.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include "gpiosim.hpp"
diff --git a/bindings/cxx/tests/tests-line-info.cpp b/bindings/cxx/tests/tests-line-info.cpp
index 21211f2..8589da3 100644
--- a/bindings/cxx/tests/tests-line-info.cpp
+++ b/bindings/cxx/tests/tests-line-info.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include <string>
@@ -35,9 +35,9 @@ TEST_CASE("get_line_info() works", "[chip][line-info]")
auto info = chip.get_line_info(0);
REQUIRE(info.offset() == 0);
- REQUIRE_THAT(info.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar"));
REQUIRE(info.used());
- REQUIRE_THAT(info.consumer(), Catch::Equals("hog"));
+ REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("hog"));
REQUIRE(info.direction() == ::gpiod::line::direction::OUTPUT);
REQUIRE_FALSE(info.active_low());
REQUIRE(info.bias() == ::gpiod::line::bias::UNKNOWN);
@@ -74,9 +74,9 @@ TEST_CASE("line properties can be retrieved", "[line-info]")
auto info6 = chip.get_line_info(6);
REQUIRE(info4.offset() == 4);
- REQUIRE_THAT(info4.name(), Catch::Equals("baz"));
+ REQUIRE_THAT(info4.name(), Catch::Matchers::Equals("baz"));
REQUIRE(info4.used());
- REQUIRE_THAT(info4.consumer(), Catch::Equals("hog4"));
+ REQUIRE_THAT(info4.consumer(), Catch::Matchers::Equals("hog4"));
REQUIRE(info4.direction() == direction::OUTPUT);
REQUIRE(info4.edge_detection() == edge::NONE);
REQUIRE_FALSE(info4.active_low());
@@ -102,10 +102,10 @@ TEST_CASE("line_info can be copied and moved")
{
auto copy(info);
REQUIRE(copy.offset() == 2);
- REQUIRE_THAT(copy.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar"));
/* info can still be used */
REQUIRE(info.offset() == 2);
- REQUIRE_THAT(info.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar"));
}
SECTION("assignment operator works")
@@ -113,17 +113,17 @@ TEST_CASE("line_info can be copied and moved")
auto copy = chip.get_line_info(0);
copy = info;
REQUIRE(copy.offset() == 2);
- REQUIRE_THAT(copy.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar"));
/* info can still be used */
REQUIRE(info.offset() == 2);
- REQUIRE_THAT(info.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar"));
}
SECTION("move constructor works")
{
auto copy(::std::move(info));
REQUIRE(copy.offset() == 2);
- REQUIRE_THAT(copy.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar"));
}
SECTION("move assignment operator works")
@@ -131,7 +131,7 @@ TEST_CASE("line_info can be copied and moved")
auto copy = chip.get_line_info(0);
copy = ::std::move(info);
REQUIRE(copy.offset() == 2);
- REQUIRE_THAT(copy.name(), Catch::Equals("foobar"));
+ REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar"));
}
}
diff --git a/bindings/cxx/tests/tests-line-request.cpp b/bindings/cxx/tests/tests-line-request.cpp
index 9632ae0..af8b979 100644
--- a/bindings/cxx/tests/tests-line-request.cpp
+++ b/bindings/cxx/tests/tests-line-request.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include <sstream>
#include <stdexcept>
@@ -20,7 +20,7 @@ using pull = ::gpiosim::chip::pull;
namespace {
-class value_matcher : public Catch::MatcherBase<value>
+class value_matcher : public Catch::Matchers::MatcherBase<value>
{
public:
value_matcher(pull pull, bool active_low = false)
@@ -117,7 +117,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]")
auto info = chip.get_line_info(2);
REQUIRE(info.used());
- REQUIRE_THAT(info.consumer(), Catch::Equals("foobar"));
+ REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("foobar"));
}
SECTION("empty consumer")
@@ -130,7 +130,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]")
auto info = chip.get_line_info(2);
REQUIRE(info.used());
- REQUIRE_THAT(info.consumer(), Catch::Equals("?"));
+ REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("?"));
}
}
@@ -380,7 +380,7 @@ TEST_CASE("line_request can be moved", "[line-request]")
auto moved(::std::move(request));
REQUIRE(moved.fd() == fd);
- REQUIRE_THAT(moved.offsets(), Catch::Equals(offs));
+ REQUIRE_THAT(moved.offsets(), Catch::Matchers::Equals(offs));
}
SECTION("move assignment operator works")
@@ -388,7 +388,7 @@ TEST_CASE("line_request can be moved", "[line-request]")
another = ::std::move(request);
REQUIRE(another.fd() == fd);
- REQUIRE_THAT(another.offsets(), Catch::Equals(offs));
+ REQUIRE_THAT(another.offsets(), Catch::Matchers::Equals(offs));
}
}
@@ -484,7 +484,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]")
{
buf << request;
- REQUIRE_THAT(buf.str(), Catch::Equals(expected.str()));
+ REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str()));
}
SECTION("request released")
@@ -493,7 +493,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]")
buf << request;
- REQUIRE_THAT(buf.str(), Catch::Equals("gpiod::line_request(released)"));
+ REQUIRE_THAT(buf.str(), Catch::Matchers::Equals("gpiod::line_request(released)"));
}
}
diff --git a/bindings/cxx/tests/tests-line-settings.cpp b/bindings/cxx/tests/tests-line-settings.cpp
index dc821bb..2690331 100644
--- a/bindings/cxx/tests/tests-line-settings.cpp
+++ b/bindings/cxx/tests/tests-line-settings.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include "helpers.hpp"
diff --git a/bindings/cxx/tests/tests-line.cpp b/bindings/cxx/tests/tests-line.cpp
index 319012a..abd0e08 100644
--- a/bindings/cxx/tests/tests-line.cpp
+++ b/bindings/cxx/tests/tests-line.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <gpiod.hpp>
#include "helpers.hpp"
diff --git a/bindings/cxx/tests/tests-misc.cpp b/bindings/cxx/tests/tests-misc.cpp
index f06dc39..33fc3fa 100644
--- a/bindings/cxx/tests/tests-misc.cpp
+++ b/bindings/cxx/tests/tests-misc.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <filesystem>
#include <gpiod.hpp>
#include <string>
diff --git a/bindings/cxx/tests/tests-request-config.cpp b/bindings/cxx/tests/tests-request-config.cpp
index 66eb748..d71e91b 100644
--- a/bindings/cxx/tests/tests-request-config.cpp
+++ b/bindings/cxx/tests/tests-request-config.cpp
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl>
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
#include <cstddef>
#include <gpiod.hpp>
#include <string>
@@ -33,7 +33,7 @@ TEST_CASE("request_config can be moved", "[request-config]")
SECTION("move constructor works")
{
auto moved(::std::move(cfg));
- REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar"));
+ REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar"));
REQUIRE(moved.event_buffer_size() == 64);
}
@@ -43,7 +43,7 @@ TEST_CASE("request_config can be moved", "[request-config]")
moved = ::std::move(cfg);
- REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar"));
+ REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar"));
REQUIRE(moved.event_buffer_size() == 64);
}
}
@@ -55,7 +55,7 @@ TEST_CASE("request_config mutators work", "[request-config]")
SECTION("set consumer")
{
cfg.set_consumer("foobar");
- REQUIRE_THAT(cfg.consumer(), Catch::Equals("foobar"));
+ REQUIRE_THAT(cfg.consumer(), Catch::Matchers::Equals("foobar"));
}
SECTION("set event_buffer_size")
@@ -77,7 +77,7 @@ TEST_CASE("request_config stream insertion operator works", "[request-config]")
::std::string expected("gpiod::request_config(consumer='foobar', event_buffer_size=32)");
- REQUIRE_THAT(buf.str(), Catch::Equals(expected));
+ REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected));
}
} /* namespace */
diff --git a/configure.ac b/configure.ac
index a2370c5..216007e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,9 +206,9 @@ then
if test "x$with_tests" = xtrue
then
- PKG_CHECK_MODULES([CATCH2], [catch2],, [
+ PKG_CHECK_MODULES([CATCH2], [catch2-with-main],, [
AC_LANG_PUSH([C++])
- AC_CHECK_HEADERS([catch2/catch.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch.hpp])])
+ AC_CHECK_HEADERS([catch2/catch_all.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch_all.hpp])])
AC_LANG_POP([C++])
])
fi
|