Changeset e21b921


Ignore:
Timestamp:
Sep 30, 2011, 8:14:50 AM (10 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
6503194
Parents:
cce9369
git-author:
Jason Gross <jgross@mit.edu> (06/27/11 02:35:05)
git-committer:
Jason Gross <jgross@mit.edu> (09/30/11 08:14:50)
Message:
Add tests for enum variables.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    rcce9369 re21b921  
    397397  FAIL_UNLESS("update string val", !strcmp("new val", owl_variable_get_string(var)));
    398398
     399  owl_variable_dict_newvar_enum(&vd, "enumvar", "", "", 0, "foo,bar,baz");
     400  FAIL_UNLESS("get new enum var", NULL != (var = owl_variable_get_var(&vd, "enumvar")));
     401  FAIL_UNLESS("get new enum var", NULL != (v = owl_variable_get(var)));
     402  FAIL_UNLESS("get new enum val tostring", !strcmp("foo", value = owl_variable_get_tostring(var)));
     403  g_free(value);
     404  FAIL_UNLESS("valid update enum var", 0 == owl_variable_set_int(var, 1));
     405  FAIL_UNLESS("update int enum val tostring", !strcmp("bar", value = owl_variable_get_tostring(var)));
     406  g_free(value);
     407  FAIL_UNLESS("update int enum val", 1 == owl_variable_get_int(var));
     408  FAIL_UNLESS("invalid update enum var", -1 == owl_variable_set_int(var, 5));
     409  FAIL_UNLESS("no update int enum val", 1 == owl_variable_get_int(var));
     410  FAIL_UNLESS("valid update enum var fromstring", 0 == owl_variable_set_fromstring(var, "baz", 0));
     411  FAIL_UNLESS("update int enum val fromstring", 2 == owl_variable_get_int(var));
     412  FAIL_UNLESS("invalid update enum var fromstring", -1 == owl_variable_set_fromstring(var, "xxx", 0));
     413  FAIL_UNLESS("no update int enum val fromstring", 2 == owl_variable_get_int(var));
     414
    399415  owl_variable_dict_newvar_int(&vd, "intvar", "", "", 47, 0);
    400416  FAIL_UNLESS("get new int var", NULL != (var = owl_variable_get_var(&vd, "intvar")));
Note: See TracChangeset for help on using the changeset viewer.