int zsys_test (bool verbose) { printf (" * zsys: "); // @selftest zsys_handler_reset (); zsys_handler_set (NULL); zsys_handler_set (NULL); zsys_handler_reset (); zsys_handler_reset (); int rc = zsys_file_delete ("nosuchfile"); assert (rc == -1); bool rc_bool = zsys_file_exists ("nosuchfile"); assert (rc_bool != true); rc = (int) zsys_file_size ("nosuchfile"); assert (rc == -1); time_t when = zsys_file_modified ("."); assert (when > 0); rc = zsys_dir_create ("%s/%s", ".", ".testsys/subdir"); assert (rc == 0); when = zsys_file_modified ("./.testsys/subdir"); assert (when > 0); rc = zsys_dir_delete ("%s/%s", ".", ".testsys/subdir"); assert (rc == 0); rc = zsys_dir_delete ("%s/%s", ".", ".testsys"); assert (rc == 0); int major, minor, patch; zsys_version (&major, &minor, &patch); assert (major == CZMQ_VERSION_MAJOR); assert (minor == CZMQ_VERSION_MINOR); assert (patch == CZMQ_VERSION_PATCH); char *string = s_vprintf ("%s %02x", "Hello", 16); assert (streq (string, "Hello 10")); zstr_free (&string); char *str64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,."; int num10 = 1234567890; string = s_vprintf ("%s%s%s%s%d", str64, str64, str64, str64, num10); assert (strlen (string) == (4 * 64 + 10)); zstr_free (&string); // @end printf ("OK\n"); return 0; }
int zsys_test (bool verbose) { printf (" * zsys: "); // @selftest zsys_handler_reset (); zsys_handler_set (NULL); zsys_handler_set (NULL); zsys_handler_reset (); zsys_handler_reset (); int rc = zsys_file_delete ("nosuchfile"); assert (rc == -1); bool rc_bool = zsys_file_exists ("nosuchfile"); assert (rc_bool != true); rc = (int) zsys_file_size ("nosuchfile"); assert (rc == -1); time_t when = zsys_file_modified ("."); assert (when > 0); rc = zsys_dir_create ("%s/%s", ".", ".testsys/subdir"); assert (rc == 0); when = zsys_file_modified ("./.testsys/subdir"); assert (when > 0); rc = zsys_dir_delete ("%s/%s", ".", ".testsys/subdir"); assert (rc == 0); char *string = s_vprintf ("%s %02x", "Hello", 16); assert (streq (string, "Hello 10")); free (string); // @end printf ("OK\n"); return 0; }