"Fossies" - the Fresh Open Source Software Archive

Member "yajl-2.1.0/test/api/gen-extra-close.c" (19 Mar 2014, 418 Bytes) of package /linux/www/yajl-2.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* ensure that if we try to generate an extra closing brace
    2  * we get the expected error */
    3 
    4 #include <yajl/yajl_gen.h>
    5 #include <stdio.h>
    6 
    7 #define CHK(x) if (x != yajl_gen_status_ok) return 1;
    8 
    9 int main(void) {
   10   yajl_gen yg;
   11   yajl_gen_status s;
   12 
   13   yg = yajl_gen_alloc(NULL);
   14   CHK(yajl_gen_map_open(yg));
   15   CHK(yajl_gen_map_close(yg));
   16   s = yajl_gen_map_close(yg);
   17 
   18   return (yajl_gen_generation_complete == s);
   19 }