This source file includes following definitions.
- main
1 #include "ompi_config.h"
2 #include "opal/util/numtostr.h"
3
4 #include <string.h>
5 #include <stdio.h>
6
7 #include "support.h"
8
9 int
10 main(int argc, char *argv[])
11 {
12 char * tst;
13 char * expected;
14
15 test_init("ompi_numtostr_t");
16
17 tst = opal_ltostr(10);
18 expected = malloc(sizeof(long) * 8);
19 snprintf(expected, sizeof(long) * 8, "%d", 10);
20 if (strcmp(tst, expected) != 0) {
21 test_failure("opal_ltostr test failed");
22 }
23 else {
24 test_success();
25 }
26
27 free(tst);
28 free(expected);
29
30 tst = opal_dtostr(5.32);
31 expected = malloc(sizeof(long) * 8);
32 snprintf(expected, sizeof(long) * 8, "%f", 5.32);
33 if (strcmp(tst, expected) != 0) {
34 test_failure("opal_dtostr test failed");
35 }
36 else {
37 test_success();
38 }
39
40 test_finalize();
41
42 return 0;
43 }