1
1

add common test support routines and reporting

This commit was SVN r1981.
Этот коммит содержится в:
Laura Casswell 2004-08-09 21:24:20 +00:00
родитель 01bedc62e1
Коммит 33c1952c79
2 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -25,7 +25,8 @@ ompi_numtostr_LDADD = \
$(top_builddir)/src/threads/mutex_pthread.lo \ $(top_builddir)/src/threads/mutex_pthread.lo \
$(top_builddir)/src/threads/mutex_spinlock.lo \ $(top_builddir)/src/threads/mutex_spinlock.lo \
$(top_builddir)/src/threads/mutex_spinwait.lo \ $(top_builddir)/src/threads/mutex_spinwait.lo \
$(top_builddir)/src/util/numtostr.lo $(top_builddir)/src/util/numtostr.lo \
$(top_builddir)/test/support/libsupport.la
ompi_numtostr_DEPENDENCIES = $(ompi_numtostr_LDADD) ompi_numtostr_DEPENDENCIES = $(ompi_numtostr_LDADD)
ompi_argv_SOURCES = ompi_argv.c ompi_argv_SOURCES = ompi_argv.c

Просмотреть файл

@ -4,17 +4,24 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "support.h"
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char * tst; char * tst;
char * expected; char * expected;
test_init("ompi_numtostr_t");
tst = ltostr(10); tst = ltostr(10);
expected = malloc(sizeof(long) * 8); expected = malloc(sizeof(long) * 8);
snprintf(expected, sizeof(long) * 8, "%d", 10); snprintf(expected, sizeof(long) * 8, "%d", 10);
if (strcmp(tst, expected) != 0) { if (strcmp(tst, expected) != 0) {
exit(1); test_failure("ltostr test failed");
}
else {
test_success();
} }
free(tst); free(tst);
@ -24,8 +31,13 @@ main(int argc, char *argv[])
expected = malloc(sizeof(long) * 8); expected = malloc(sizeof(long) * 8);
snprintf(expected, sizeof(long) * 8, "%f", 5.32); snprintf(expected, sizeof(long) * 8, "%f", 5.32);
if (strcmp(tst, expected) != 0) { if (strcmp(tst, expected) != 0) {
exit(1); test_failure("dtostr test failed");
} }
else {
test_success();
}
test_finalize();
return 0; return 0;
} }