- gras_cfg_set_parse(set,"hostname:toto:42");
- gras_cfg_set_parse(set,"speed:42 speed:24");
- gras_cfg_check(set);
- gras_cfg_get_int(set,"speed",&ival);
- printf("speed value: %d\n",ival);
- gras_cfg_free(&set);
-
- fprintf(stderr,"\n§§§§§§§§§ %s §§§§§§§§§\n§§§ Expected: %s\n",
- "TEST5",
- "Count: 3; Options:\\nmquinson\\necaron\\nfsuter");
- test5();
+ xbt_cfg_set_parse(set,"hostname:toto:42");
+ xbt_cfg_set_parse(set,"speed:42 speed:24 speed:34");
+ xbt_cfg_check(set);
+ xbt_cfg_free(&set);
+ xbt_cfg_free(&set);
+
+ fprintf(stderr,"==== Get single value (Expected: 'speed value: 42')\n");
+ {
+ /* get_single_value */
+ int ival;
+ xbt_cfg_t myset=make_set();
+
+ xbt_cfg_set_parse(myset,"hostname:toto:42 speed:42");
+ xbt_cfg_get_int(myset,"speed",&ival);
+ fprintf(stderr,"speed value: %d\n",ival); /* Prints: "speed value: 42" */
+ xbt_cfg_free(&myset);
+ }
+
+ fprintf(stderr,"==== Get multiple values (Expected: 'Count: 3; Options: mquinson;ecaron;alegrand;')\n");
+ {
+ /* get_multiple_value */
+ xbt_dynar_t dyn;
+ int ival;
+ xbt_cfg_t myset=make_set();
+
+ xbt_cfg_set_parse(myset, "hostname:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
+ xbt_cfg_set_parse(myset,"speed:42");
+ xbt_cfg_check(myset);
+ xbt_cfg_get_dynar(myset,"user",&dyn);
+ fprintf(stderr,"Count: %lu; Options: ",xbt_dynar_length(dyn));
+ xbt_dynar_foreach(dyn,ival,str) {
+ fprintf(stderr,"%s;",str);
+ }
+ fprintf(stderr,"\n");
+ /* This prints: "Count: 3; Options: mquinson;ecaron;alegrand;" */
+ xbt_cfg_free(&myset);
+ }
+
+ fprintf(stderr,"==== Try to use an unregistered option. (ERROR EXPECTED: 'color' not registered)\n");
+ {
+ xbt_cfg_t myset=make_set();
+ TRYEXPECT(mismatch_error,xbt_cfg_set_parse(myset,"color:blue"));
+ /* This spits an error: 'color' not registered */
+ xbt_cfg_free(&myset);
+ }