3 * File: rec-parser-new-mem.c
4 * Date: Fri May 25 11:14:05 2012
6 * GNU recutils - rec_parser_new_mem unit tests.
10 /* Copyright (C) 2010-2015 Jose E. Marchesi */
11 /* Copyright (C) 2012-2015 Michał Masłowski */
13 /* This program is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 /* Based on rec_parse_rset unit tests. */
37 * Test: rec_parser_new_mem_nominal
38 * Unit: rec_parser_new_mem
40 * + Parse a valid truncated record set.
42 START_TEST(rec_parser_new_mem_nominal
)
49 str
= "foo1: bar1\n\nfoo2: bar2\n\nfoo3: bar3";
50 short_str
= "foo1: bar1\n\nfoo2: bar2";
51 parser
= rec_parser_new_mem (str
, strlen(short_str
), "dummy");
52 fail_if (!rec_parse_rset (parser
, &rset
));
53 fail_if (rec_rset_num_records (rset
) != 2);
54 rec_rset_destroy (rset
);
55 rec_parser_destroy (parser
);
60 * Test creation function
63 test_rec_parser_new_mem (void)
65 TCase
*tc
= tcase_create ("rec_parser_new_mem");
66 tcase_add_test (tc
, rec_parser_new_mem_nominal
);
71 /* End of rec-parser-new-mem.c */