first version upgrade
[devspec.git] / devspec.en_US / project / recutils / torture / rec-parser / rec-parser-reset.c
bloba6ba8a12b833524f6672621076c90b5a19e6351e
1 /* -*- mode: C -*-
3 * File: rec-parser-reset.c
4 * Date: Sat Nov 13 22:34:36 2010
6 * GNU recutils - rec_parser_reset unit tests.
8 */
10 /* Copyright (C) 2010-2015 Jose E. Marchesi */
12 /* This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include <config.h>
28 #include <check.h>
29 #include <rec.h>
31 /*-
32 * Test: rec_parser_reset_nominal
33 * Unit: rec_parser_reset
34 * Description:
35 * + Reset a rec parser.
37 START_TEST(rec_parser_reset_nominal)
39 rec_parser_t parser;
40 rec_field_t field;
41 char *str;
43 str = "invalid field";
44 parser = rec_parser_new_str (str, "dummy");
45 fail_if (parser == NULL);
46 fail_if (rec_parser_error (parser));
47 fail_if (rec_parse_field (parser, &field));
48 fail_if (!rec_parser_error (parser));
49 rec_parser_reset (parser);
50 fail_if (rec_parser_error (parser));
51 rec_parser_destroy (parser);
53 END_TEST
56 * Test creation function
58 TCase *
59 test_rec_parser_reset (void)
61 TCase *tc = tcase_create ("rec_parser_reset");
62 tcase_add_test (tc, rec_parser_reset_nominal);
64 return tc;
67 /* End of rec-parser-reset.c */