+ 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");
+ ival = xbt_cfg_get_int(myset,"speed");
+ 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);
+ dyn = xbt_cfg_get_dynar(myset,"user");
+ 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();
+ TRY {
+ xbt_cfg_set_parse(myset,"color:blue");
+ THROW1(mismatch_error,0,"Found an option which shouldn't be there (%s)","color:blue");
+ } CATCH(e) {
+ if (e.category != not_found_error)
+ RETHROW;
+ xbt_ex_free(e);
+ }
+ /* This spits an error: 'color' not registered */
+ xbt_cfg_free(&myset);
+ }