Debian Codegraph @

doc/tutorial_src/crash_tests3.c

raw symbols SCIP
1 #include <cgreen/cgreen.h>
2 #include <stdlib.h>
3
4 Describe(CrashExample);
5 BeforeEach(CrashExample) {}
6 AfterEach(CrashExample) {}
7
8 Ensure(CrashExample, seg_faults_for_null_dereference) {
9 int *p = NULL;
10 (*p)++;
11 }
12
13 Ensure(CrashExample, will_loop_forever) {
14 die_in(1);
15 while(0 == 0) { }
16 }
17
18 int main(int argc, char **argv) {
19 TestSuite *suite = create_test_suite();
20 add_test_with_context(suite, CrashExample, seg_faults_for_null_dereference);
21 add_test_with_context(suite, CrashExample, will_loop_forever);
22 return run_test_suite(suite, create_text_reporter());
23 }