We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f2ba14 commit 18fd4d4Copy full SHA for 18fd4d4
tests/callable_tests.cc
@@ -0,0 +1,15 @@
1
+#include "doctest.h"
2
+#include "util/callable.hh"
3
+
4
+TEST_CASE("Callable Function") {
5
+ auto capture{0};
6
+ auto func = Function<int(int, int)>{[&capture](int a, int b) {
7
+ capture += 10;
8
+ return a + b + capture;
9
+ }};
10
11
+ CHECK(func(10, 10) == 30);
12
+ CHECK(capture == 10);
13
+ CHECK(func(10, 10) == 40);
14
+ CHECK(capture == 20);
15
+}
0 commit comments