Annotation of embedaddon/confuse/tests/setmulti_reset.c, revision 1.1.1.1

1.1       misho       1: #include "check_confuse.h"
                      2: 
                      3: int main(void)
                      4: {
                      5:        cfg_opt_t opts[] = {
                      6:                CFG_INT_LIST("int", "{1,2}", CFGF_NONE),
                      7:                CFG_END()
                      8:        };
                      9: 
                     10:        /* Calling cfg_setopt after cfg_init should not append to the list. */
                     11:        cfg_t *cfg = cfg_init(opts, 0);
                     12:        fail_unless(cfg_size(cfg, "int") == 2);
                     13:        fail_unless(cfg_setopt(cfg, cfg_getopt(cfg, "int"), "3"));
                     14:        fail_unless(cfg_size(cfg, "int") == 1);
                     15:        cfg_free(cfg);
                     16: 
                     17:        /* Not even if you first attempt to use cfg_setmulti with bad input. */
                     18:        cfg = cfg_init(opts, 0);
                     19:        char *bad[] = { "bad" };
                     20:        fail_unless(cfg_size(cfg, "int") == 2);
                     21:        fail_unless(cfg_setmulti(cfg, "int", 1, bad) == CFG_FAIL);
                     22:        fail_unless(cfg_size(cfg, "int") == 2);
                     23:        fail_unless(cfg_setopt(cfg, cfg_getopt(cfg, "int"), "3"));
                     24:        fail_unless(cfg_size(cfg, "int") == 1);
                     25:        cfg_free(cfg);
                     26: 
                     27:        return 0;
                     28: }
                     29: 
                     30: /**
                     31:  * Local Variables:
                     32:  *  indent-tabs-mode: t
                     33:  *  c-file-style: "linux"
                     34:  * End:
                     35:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>