1 /* -*- mode: C -*- Time-stamp: "2015-04-27 19:59:28 jemarch"
3 * File: rec-fex-elem-rewrite-to.c
4 * Date: Sun Feb 26 13:14:15 2012
6 * GNU recutils - rec_fex_elem_rewrite_to unit tests.
10 /* Copyright (C) 2012-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/>.
33 * Test: rec_fex_elem_rewrite_to_default
34 * Unit: rec_fex_elem_rewrite_to
36 * + The rewrite_to property of a fex
37 * + elem without a rewrite rule must be NULL.
39 START_TEST(rec_fex_elem_rewrite_to_default
)
44 fex
= rec_fex_new ("foo,bar,baz", REC_FEX_SUBSCRIPTS
);
45 fail_if (fex
== NULL
);
47 elem
= rec_fex_get (fex
, 0);
48 fail_if (elem
== NULL
);
49 fail_if (rec_fex_elem_rewrite_to (elem
) != NULL
);
51 rec_fex_destroy (fex
);
56 * Test: rec_fex_elem_rewrite_to_nominal
57 * Unit: rec_fex_elem_rewrite_to
59 * + The rewrite_to property of a fex
60 * + elem must be properly parsed and returned.
62 START_TEST(rec_fex_elem_rewrite_to_nominal
)
67 fex
= rec_fex_new ("foo,bar:xxx,baz", REC_FEX_SUBSCRIPTS
);
68 fail_if (fex
== NULL
);
70 elem
= rec_fex_get (fex
, 1);
71 fail_if (elem
== NULL
);
72 fail_if (rec_fex_elem_rewrite_to (elem
) == NULL
);
73 fail_if (strcmp (rec_fex_elem_rewrite_to (elem
), "xxx") != 0);
75 rec_fex_destroy (fex
);
80 * Test case creation function
84 test_rec_fex_elem_rewrite_to (void)
86 TCase
*tc
= tcase_create ("rec_fex_elem_rewrite_to");
87 tcase_add_test (tc
, rec_fex_elem_rewrite_to_default
);
88 tcase_add_test (tc
, rec_fex_elem_rewrite_to_nominal
);
93 /* End of rec-fex-elem-rewrite-to.c */