|
GnuCash 2.4.99
|
00001 00002 #include "config.h" 00003 00004 #include "test-stuff.h" 00005 #include "test-engine-stuff.h" 00006 #include "test-file-stuff.h" 00007 00008 #include <stdlib.h> 00009 00010 #include "sixtp-utils.h" 00011 #include "sixtp-dom-generators.h" 00012 00013 #define GNC_V2_STRING "gnc-v2" 00014 const gchar *gnc_v2_xml_version_string = GNC_V2_STRING; 00015 00016 int 00017 main(int argc, char **argv) 00018 { 00019 int i; 00020 00021 for (i = 0; i < 20; i++) 00022 { 00023 Timespec *spec1; 00024 Timespec spec2; 00025 gchar *sec_str; 00026 gchar *nsec_str; 00027 00028 spec1 = get_random_timespec(); 00029 00030 sec_str = timespec_sec_to_string(spec1); 00031 nsec_str = timespec_nsec_to_string(spec1); 00032 00033 if (!string_to_timespec_secs(sec_str, &spec2)) 00034 { 00035 failure_args("string_to_timespec_secs", __FILE__, __LINE__, 00036 "string is %s", sec_str); 00037 } 00038 00039 else if (!string_to_timespec_nsecs(nsec_str, &spec2)) 00040 { 00041 failure_args("string_to_timespec_nsecs", __FILE__, __LINE__, 00042 "string is %s", nsec_str); 00043 } 00044 00045 else if (spec1->tv_sec != spec2.tv_sec) 00046 { 00047 failure_args("timespec_secs", __FILE__, __LINE__, 00048 "not equal ints are %" G_GINT64_FORMAT 00049 " and %" G_GINT64_FORMAT "\n", 00050 spec1->tv_sec, spec2.tv_sec); 00051 } 00052 00053 else if (spec1->tv_nsec != spec2.tv_nsec) 00054 { 00055 failure_args("timespec_nsecs", __FILE__, __LINE__, 00056 "not equal ints are %ld and %ld\n", 00057 spec1->tv_nsec, spec2.tv_nsec); 00058 } 00059 00060 else 00061 { 00062 success("timespec"); 00063 } 00064 00065 g_free(spec1); 00066 g_free(sec_str); 00067 g_free(nsec_str); 00068 } 00069 print_test_results(); 00070 exit(get_rv()); 00071 }
1.7.4