Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/config Modified Files: ewl_config_test.c Log Message: - tabs are a tricky beast. looks like I missed some. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/config/ewl_config_test.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_config_test.c 6 May 2008 20:09:02 -0000 1.4 +++ ewl_config_test.c 7 May 2008 13:38:15 -0000 1.5 @@ -27,16 +27,16 @@ */ static Ewl_Unit_Test config_unit_tests[] = { - {"string get/set", string_get_set, NULL, -1, 0}, - {"int get/set", int_get_set, NULL, -1, 0}, - {"float get/set", float_get_set, NULL, -1, 0}, - {"color get/set", color_get_set, NULL, -1, 0}, - {"string overwrite", string_overwrite, NULL, -1, 0}, - {"int overwrite", int_overwrite, NULL, -1, 0}, - {"float overwrite", float_overwrite, NULL, -1, 0}, - {"color overwrite", color_overwrite, NULL, -1, 0}, - {"remove key", remove_key, NULL, -1, 0}, - {NULL, NULL, NULL, -1, 0} + {"string get/set", string_get_set, NULL, -1, 0}, + {"int get/set", int_get_set, NULL, -1, 0}, + {"float get/set", float_get_set, NULL, -1, 0}, + {"color get/set", color_get_set, NULL, -1, 0}, + {"string overwrite", string_overwrite, NULL, -1, 0}, + {"int overwrite", int_overwrite, NULL, -1, 0}, + {"float overwrite", float_overwrite, NULL, -1, 0}, + {"color overwrite", color_overwrite, NULL, -1, 0}, + {"remove key", remove_key, NULL, -1, 0}, + {NULL, NULL, NULL, -1, 0} }; void @@ -67,28 +67,28 @@ /* first try to get a string that cannot exist */ value = ewl_config_string_get(conf, "climate"); if (value) { - LOG_FAILURE(buf, len, "config finds an string for" - "non-existing key"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config finds an string for" + "non-existing key"); + goto CLEANUP; } /* now try to get the weather report */ value = ewl_config_string_get(conf, "weather"); if (!value) { - LOG_FAILURE(buf, len, "config does not find the string we set"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config does not find the string we set"); + goto CLEANUP; } if (strcmp(value, string)) { - LOG_FAILURE(buf, len, "config returned a different string"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returned a different string"); + goto CLEANUP; } /* the config must not save our address */ if (value == string) { - LOG_FAILURE(buf, len, "config returned the address of the set " - "string"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returned the address of the set " + "string"); + goto CLEANUP; } /* everything went fine */ @@ -120,16 +120,16 @@ /* on error it should return 0 */ if (value != 0) { - LOG_FAILURE(buf, len, "config returns a number unequal zero for" - "non-existing key"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns a number unequal zero for" + "non-existing key"); + goto CLEANUP; } /* now try to get the set number */ value = ewl_config_int_get(conf, "number"); if (value != number) { - LOG_FAILURE(buf, len, "config returns wrong number"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns wrong number"); + goto CLEANUP; } /* everything went fine */ @@ -161,16 +161,16 @@ /* on error it should return 0.0, according to the docs */ if (value != 0.0) { - LOG_FAILURE(buf, len, "config returns a number unequal zero for" - "non-existing key"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns a number unequal zero for" + "non-existing key"); + goto CLEANUP; } /* now try to get the set velocity */ value = ewl_config_float_get(conf, "velocity"); if (value != number) { - LOG_FAILURE(buf, len, "config returns wrong number"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns wrong number"); + goto CLEANUP; } /* everything went fine */ @@ -195,23 +195,23 @@ conf = ewl_config_new("unit test"); ewl_config_color_set(conf, "bg_color", 0, 100, 200, 255, - EWL_STATE_TRANSIENT); + EWL_STATE_TRANSIENT); /* first try to get a value that cannot exist */ ewl_config_color_get(conf, "fg_color", &r, &g, &b, &a); /* on error it should return 0 */ if (r != 0 || g != 0 || b != 0 || a != 0) { - LOG_FAILURE(buf, len, "config returns not (0,0,0,0) for " - "non-existing key"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns not (0,0,0,0) for " + "non-existing key"); + goto CLEANUP; } /* now try to get the set number */ ewl_config_color_get(conf, "bg_color", &r, &g, &b, &a); if (r != 0 || g != 100 || b != 200 || a != 255) { - LOG_FAILURE(buf, len, "config returns wrong color"); - goto CLEANUP; + LOG_FAILURE(buf, len, "config returns wrong color"); + goto CLEANUP; } /* everything went fine */ @@ -232,30 +232,30 @@ int ret = 1; Ewl_Config *conf; const char *strings[] = { - "First Value", - "Second Value", - "Yet another", - "The last one", - NULL + "First Value", + "Second Value", + "Yet another", + "The last one", + NULL }; const char **string = strings; conf = ewl_config_new("unit test"); while (*string == NULL) { - const char *value; + const char *value; - ewl_config_string_set(conf, "test key", *string, - EWL_STATE_TRANSIENT); - value = ewl_config_string_get(conf, "test key"); - - if (strcmp(value, *string)) { - LOG_FAILURE(buf, len, "The returned string is different" - " from the set string"); - ret = 0; - break; - } - string++; + ewl_config_string_set(conf, "test key", *string, + EWL_STATE_TRANSIENT); + value = ewl_config_string_get(conf, "test key"); + + if (strcmp(value, *string)) { + LOG_FAILURE(buf, len, "The returned string is different" + " from the set string"); + ret = 0; + break; + } + string++; } ewl_config_destroy(conf); @@ -276,18 +276,18 @@ conf = ewl_config_new("unit test"); for (i = 0; i < 12; i++) { - int v = RAND_RANGE(-1000, 1000); - int v_r; + int v = RAND_RANGE(-1000, 1000); + int v_r; - ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT); - v_r = ewl_config_int_get(conf, "test key"); + ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT); + v_r = ewl_config_int_get(conf, "test key"); - if (v_r != v) { - LOG_FAILURE(buf, len, "The returned int is different" - " from the set int"); - ret = 0; - break; - } + if (v_r != v) { + LOG_FAILURE(buf, len, "The returned int is different" + " from the set int"); + ret = 0; + break; + } } ewl_config_destroy(conf); @@ -308,18 +308,18 @@ conf = ewl_config_new("unit test"); for (i = 0; i < 12; i++) { - float v = rand(); - float v_r; + float v = rand(); + float v_r; - ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT); - v_r = ewl_config_int_get(conf, "test key"); + ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT); + v_r = ewl_config_int_get(conf, "test key"); - if (v_r != v) { - LOG_FAILURE(buf, len, "The returned float is different" - " from the set float"); - ret = 0; - break; - } + if (v_r != v) { + LOG_FAILURE(buf, len, "The returned float is different" + " from the set float"); + ret = 0; + break; + } } ewl_config_destroy(conf); @@ -340,22 +340,22 @@ conf = ewl_config_new("unit test"); for (i = 0; i < 12; i++) { - int r = RAND_RANGE(0, 255); - int g = RAND_RANGE(0, 255); - int b = RAND_RANGE(0, 255); - int a = RAND_RANGE(0, 255); - int r_r, g_r, b_r, a_r; - - ewl_config_color_set(conf, "test key", r, g, b, a, - EWL_STATE_TRANSIENT); - ewl_config_color_get(conf, "test key", &r_r, &g_r, &b_r, &a_r); - - if (r_r != r || g_r != g || b_r != b || a_r != a) { - LOG_FAILURE(buf, len, "The returned color is different" - " from the set color"); - ret = 0; - break; - } + int r = RAND_RANGE(0, 255); + int g = RAND_RANGE(0, 255); + int b = RAND_RANGE(0, 255); + int a = RAND_RANGE(0, 255); + int r_r, g_r, b_r, a_r; + + ewl_config_color_set(conf, "test key", r, g, b, a, + EWL_STATE_TRANSIENT); + ewl_config_color_get(conf, "test key", &r_r, &g_r, &b_r, &a_r); + + if (r_r != r || g_r != g || b_r != b || a_r != a) { + LOG_FAILURE(buf, len, "The returned color is different" + " from the set color"); + ret = 0; + break; + } } ewl_config_destroy(conf); @@ -405,81 +405,81 @@ ewl_config_key_remove(cfg, "/test/key"); if (ecore_hash_get(cfg->data.system, "/test/key") != NULL) { - LOG_FAILURE(buf, len, "System hash contains key after key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "System hash contains key after key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.user, "/test/key") != NULL) { - LOG_FAILURE(buf, len, "User hash contains key after key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "User hash contains key after key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.instance, "/test/key") != NULL) { - LOG_FAILURE(buf, len, "Instance hash contains key after key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "Instance hash contains key after key remove"); + ret = 0; + goto EXIT; } ewl_config_system_key_remove(cfg, "/system/remove"); if (ecore_hash_get(cfg->data.system, "/system/remove") != NULL) { - LOG_FAILURE(buf, len, "System hash contains key after system key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "System hash contains key after system key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.user, "/system/remove") == NULL) { - LOG_FAILURE(buf, len, "User hash missing key after system key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "User hash missing key after system key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.instance, "/system/remove") == NULL) { - LOG_FAILURE(buf, len, "Instance hash missing key after system key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "Instance hash missing key after system key remove"); + ret = 0; + goto EXIT; } ewl_config_user_key_remove(cfg, "/user/remove"); if (ecore_hash_get(cfg->data.system, "/user/remove") == NULL) { - LOG_FAILURE(buf, len, "System hash missing key after user key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "System hash missing key after user key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.user, "/user/remove") != NULL) { - LOG_FAILURE(buf, len, "User hash contains key after user key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "User hash contains key after user key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.instance, "/user/remove") == NULL) { - LOG_FAILURE(buf, len, "Instance hash missing key after user key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "Instance hash missing key after user key remove"); + ret = 0; + goto EXIT; } ewl_config_instance_key_remove(cfg, "/instance/remove"); if (ecore_hash_get(cfg->data.system, "/instance/remove") == NULL) { - LOG_FAILURE(buf, len, "System hash missing key after instance key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "System hash missing key after instance key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.user, "/instance/remove") == NULL) { - LOG_FAILURE(buf, len, "User hash missing key after instance key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "User hash missing key after instance key remove"); + ret = 0; + goto EXIT; } else if (ecore_hash_get(cfg->data.instance, "/instance/remove") != NULL) { - LOG_FAILURE(buf, len, "Instance hash contains key after instance key remove"); - ret = 0; - goto EXIT; + LOG_FAILURE(buf, len, "Instance hash contains key after instance key remove"); + ret = 0; + goto EXIT; } EXIT: ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs