e55f99d23a
* rename ompi_malloc to opal_malloc * rename ompi_numtostr to opal_numtostr * start of rename of ompi_environ to opal_environ This commit was SVN r6332.
44 строки
824 B
C
44 строки
824 B
C
#include "ompi_config.h"
|
|
#include "opal/util/numtostr.h"
|
|
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "support.h"
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
char * tst;
|
|
char * expected;
|
|
|
|
test_init("ompi_numtostr_t");
|
|
|
|
tst = opal_ltostr(10);
|
|
expected = malloc(sizeof(long) * 8);
|
|
snprintf(expected, sizeof(long) * 8, "%d", 10);
|
|
if (strcmp(tst, expected) != 0) {
|
|
test_failure("opal_ltostr test failed");
|
|
}
|
|
else {
|
|
test_success();
|
|
}
|
|
|
|
free(tst);
|
|
free(expected);
|
|
|
|
tst = opal_dtostr(5.32);
|
|
expected = malloc(sizeof(long) * 8);
|
|
snprintf(expected, sizeof(long) * 8, "%f", 5.32);
|
|
if (strcmp(tst, expected) != 0) {
|
|
test_failure("opal_dtostr test failed");
|
|
}
|
|
else {
|
|
test_success();
|
|
}
|
|
|
|
test_finalize();
|
|
|
|
return 0;
|
|
}
|