Skip to content

Commit 19eff97

Browse files
committed
Extend existing tests
1 parent f235dab commit 19eff97

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

‎tests/unit/alias_over_function_pointer.cpp‎

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

‎tests/unit/fn_ptr.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <assert.h>
22
#include <cstddef>
3+
#include <signal.h>
34
#include <stddef.h>
45

56
typedef int (*foo_t)(void *);
@@ -28,6 +29,10 @@ template <class H> struct HashHolder {
2829
HashHolder(const H &h) : h(h) {}
2930
};
3031

32+
static int total = 0;
33+
34+
void add_to_total(int x) { total += x; }
35+
3136
int main() {
3237
foo_t fn = nullptr;
3338
assert(fn == nullptr);
@@ -55,5 +60,10 @@ int main() {
5560

5661
HashHolder<std::size_t (*)(bool)> hh(identity_hash<bool>);
5762
assert(hh.h(true) == 1);
63+
64+
sig_t handler = add_to_total;
65+
handler(2);
66+
handler(3);
67+
assert(total == 5);
5868
return 0;
5969
}

0 commit comments

Comments
 (0)