summaryrefslogtreecommitdiff
path: root/source/tests/test_signals.cpp
blob: 2a9c009ca484dbc19a45424ba9a7372d29b9a19a (plain)
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
#define KIT_TEST_IMPLEMENTATION
#include "../kit/kit_test.h"

#include <cstdlib>
#include <stdexcept>

//  Signal handling don't work in MinGW
//
#ifndef __MINGW32__
TEST("c++ std::exception") {
  throw std::exception();
}

//  Can't handle multiple terminate signals on Windows
#  ifndef _WIN32
TEST("abort") {
  abort();
}
#  endif

TEST("invalid access") {
  *(volatile int *) nullptr = 42;
}

int main(int argc, char **argv) {
  return run_tests(argc, argv) ? 0 : 1;
}
#else
int main(int argc, char **argv) {
  return 0;
}
#endif

#undef KIT_TEST_FILE