#include "ompi_config.h" #include "util/numtostr.h" #include #include #include "support.h" int main(int argc, char *argv[]) { char * tst; char * expected; test_init("ompi_numtostr_t"); tst = ompi_ltostr(10); expected = malloc(sizeof(long) * 8); snprintf(expected, sizeof(long) * 8, "%d", 10); if (strcmp(tst, expected) != 0) { test_failure("ompi_ltostr test failed"); } else { test_success(); } free(tst); free(expected); tst = ompi_dtostr(5.32); expected = malloc(sizeof(long) * 8); snprintf(expected, sizeof(long) * 8, "%f", 5.32); if (strcmp(tst, expected) != 0) { test_failure("ompi_dtostr test failed"); } else { test_success(); } test_finalize(); return 0; }