00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <libheraia.h>
00030
00031 static gboolean test_one_function(DecodeFunc a_function, gchar *function_name, guchar *data, gpointer data_struct, gchar *expected_result);
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 static gboolean test_one_function(DecodeFunc a_function, gchar *function_name, guchar *data, gpointer data_struct, gchar *expected_result)
00045 {
00046 gchar *ret_code = NULL;
00047
00048 ret_code = a_function(data, data_struct);
00049
00050 if (g_strcmp0(ret_code, expected_result) == 0)
00051 {
00052 return TRUE;
00053 }
00054 else
00055 {
00056 fprintf(stderr, "WARNING : expected result was not good with %s\n", function_name);
00057 return FALSE;
00058 }
00059 }
00060
00061
00062
00063
00064
00065
00066 gboolean test_decode_functions(void)
00067 {
00068
00069 gboolean exit_value = TRUE;
00070
00071 exit_value = exit_value && test_one_function(decode_8bits_signed, "decode_8bits_signed", NULL, NULL, NULL);
00072 exit_value = exit_value && test_one_function(decode_8bits_unsigned, "decode_8bits_unsigned", NULL, NULL, NULL);
00073
00074 exit_value = exit_value && test_one_function(decode_16bits_signed, "decode_16bits_signed", NULL, NULL, NULL);
00075 exit_value = exit_value && test_one_function(decode_16bits_unsigned, "decode_16bits_unsigned", NULL, NULL, NULL);
00076
00077 exit_value = exit_value && test_one_function(decode_32bits_signed, "decode_32bits_signed", NULL, NULL, NULL);
00078 exit_value = exit_value && test_one_function(decode_32bits_unsigned, "decode_32bits_unsigned", NULL, NULL, NULL);
00079
00080 exit_value = exit_value && test_one_function(decode_64bits_signed, "decode_64bits_signed", NULL, NULL, NULL);
00081 exit_value = exit_value && test_one_function(decode_64bits_unsigned, "decode_64bits_unsigned", NULL, NULL, NULL);
00082
00083 exit_value = exit_value && test_one_function(decode_float_normal, "decode_float_normal", NULL, NULL, NULL);
00084 exit_value = exit_value && test_one_function(decode_float_scientific, "decode_float_scientific", NULL, NULL, NULL);
00085
00086 exit_value = exit_value && test_one_function(decode_double_normal, "decode_double_normal", NULL, NULL, NULL);
00087 exit_value = exit_value && test_one_function(decode_double_scientific, "decode_double_scientific", NULL, NULL, NULL);
00088
00089 return exit_value;
00090 }
00091
00092
00093
00094
00095
00096
00097 gboolean tests_ui(heraia_struct_t *main_struct)
00098 {
00099
00100 return TRUE;
00101 }