mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Move test.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5185 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a37d3aab41
commit
9e509b4484
@ -1,4 +1,5 @@
|
|||||||
Makefile
|
Makefile
|
||||||
|
test-date-converting
|
||||||
test-dom-converters1
|
test-dom-converters1
|
||||||
test-kvp-frames
|
test-kvp-frames
|
||||||
test-string-converters
|
test-string-converters
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
TESTS = \
|
TESTS = \
|
||||||
|
test-date-converting \
|
||||||
test-dom-converters1 \
|
test-dom-converters1 \
|
||||||
test-kvp-frames \
|
test-kvp-frames \
|
||||||
test-load-example-account \
|
test-load-example-account \
|
||||||
@ -22,6 +23,7 @@ noinst_LTLIBRARIES = libgnc-test-file-stuff.la
|
|||||||
libgnc_test_file_stuff_la_SOURCES = test-file-stuff.c
|
libgnc_test_file_stuff_la_SOURCES = test-file-stuff.c
|
||||||
|
|
||||||
noinst_PROGRAMS = \
|
noinst_PROGRAMS = \
|
||||||
|
test-date-converting \
|
||||||
test-dom-converters1 \
|
test-dom-converters1 \
|
||||||
test-kvp-frames \
|
test-kvp-frames \
|
||||||
test-load-example-account \
|
test-load-example-account \
|
||||||
|
67
src/backend/file/test/test-date-converting.c
Normal file
67
src/backend/file/test/test-date-converting.c
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "test-stuff.h"
|
||||||
|
#include "test-engine-stuff.h"
|
||||||
|
#include "test-file-stuff.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "sixtp-utils.h"
|
||||||
|
#include "sixtp-dom-generators.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
Timespec *spec1;
|
||||||
|
Timespec spec2;
|
||||||
|
gchar *sec_str;
|
||||||
|
gchar *nsec_str;
|
||||||
|
|
||||||
|
spec1 = get_random_timespec();
|
||||||
|
|
||||||
|
sec_str = timespec_sec_to_string(spec1);
|
||||||
|
nsec_str = timespec_nsec_to_string(spec1);
|
||||||
|
|
||||||
|
if(!string_to_timespec_secs(sec_str, &spec2))
|
||||||
|
{
|
||||||
|
failure_args("string_to_timespec_secs", __FILE__, __LINE__,
|
||||||
|
"string is %s", sec_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(!string_to_timespec_nsecs(nsec_str, &spec2))
|
||||||
|
{
|
||||||
|
failure_args("string_to_timespec_nsecs", __FILE__, __LINE__,
|
||||||
|
"string is %s", nsec_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(spec1->tv_sec != spec2.tv_sec)
|
||||||
|
{
|
||||||
|
failure_args("timespec_secs", __FILE__, __LINE__,
|
||||||
|
"not equal ints are %lld and %lld\n",
|
||||||
|
spec1->tv_sec, spec2.tv_sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(spec1->tv_nsec != spec2.tv_nsec)
|
||||||
|
{
|
||||||
|
failure_args("timespec_nsecs", __FILE__, __LINE__,
|
||||||
|
"not equal ints are %ld and %ld\n",
|
||||||
|
spec1->tv_nsec, spec2.tv_nsec);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success("timespec");
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(spec1);
|
||||||
|
g_free(sec_str);
|
||||||
|
g_free(nsec_str);
|
||||||
|
}
|
||||||
|
print_test_results();
|
||||||
|
exit(get_rv());
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user