Debian Codegraph @

tests/2272.c

raw
1 /// \file
2 /// \brief test case for repeated use of agmemread() with unterminated strings
3 ///
4 /// See test_regression.py:test_2272
5
6 #include <assert.h>
7 #include <graphviz/cgraph.h>
8
9 #ifdef NDEBUG
10 #error "this code is not intended to be compiled with assertions disabled"
11 #endif
12
13 int main(void) {
14
15 // parse a graph with an unterminated string
16 Agraph_t *g = agmemread("graph { a[label=\"abc");
17
18 // this should have failed
19 assert(g == NULL && "unterminated string was not rejected");
20
21 // try parsing this graph again
22 g = agmemread("graph { a[label=\"abc");
23
24 // this one should fail too
25 assert(g == NULL);
26
27 return 0;
28 }