aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_strings.c')
-rw-r--r--src/util/test_strings.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index a1614b487..97b0f4105 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -49,33 +49,26 @@ check ()
49 b = GNUNET_STRINGS_byte_size_fancy (10240LL * 1024LL * 1024LL * 1024LL); 49 b = GNUNET_STRINGS_byte_size_fancy (10240LL * 1024LL * 1024LL * 1024LL);
50 WANT (buf, b); 50 WANT (buf, b);
51 sprintf (buf, "4 %s", _( /* time unit */ "ms")); 51 sprintf (buf, "4 %s", _( /* time unit */ "ms"));
52 b = 52 b = GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply
53 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply 53 (GNUNET_TIME_UNIT_MILLISECONDS,
54 (GNUNET_TIME_UNIT_MILLISECONDS, 54 4));
55 4));
56 WANT (buf, b); 55 WANT (buf, b);
57 sprintf (buf, "7 %s", _( /* time unit */ "s")); 56 sprintf (buf, "7 %s", _( /* time unit */ "s"));
58 b = 57 b = GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply
59 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply 58 (GNUNET_TIME_UNIT_MILLISECONDS,
60 (GNUNET_TIME_UNIT_MILLISECONDS, 59 7 * 1000));
61 7 * 1000));
62 WANT (buf, b); 60 WANT (buf, b);
63 sprintf (buf, "7 %s", _( /* time unit */ "h")); 61 sprintf (buf, "7 %s", _( /* time unit */ "h"));
64 b = 62 b = GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply
65 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_relative_multiply 63 (GNUNET_TIME_UNIT_MILLISECONDS,
66 (GNUNET_TIME_UNIT_MILLISECONDS, 64 7 * 60 * 60 * 1000));
67 7 * 60 * 60 * 1000));
68 WANT (buf, b); 65 WANT (buf, b);
69#ifndef MINGW 66#ifndef MINGW
70 hdir = getenv ("HOME"); 67 hdir = getenv ("HOME");
71#else 68#else
72 hdir = getenv ("USERPROFILE"); 69 hdir = getenv ("USERPROFILE");
73#endif 70#endif
74 GNUNET_snprintf (buf, 71 GNUNET_snprintf (buf, sizeof (buf), "%s%s", hdir, DIR_SEPARATOR_STR);
75 sizeof (buf),
76 "%s%s",
77 hdir,
78 DIR_SEPARATOR_STR);
79 b = GNUNET_STRINGS_filename_expand ("~"); 72 b = GNUNET_STRINGS_filename_expand ("~");
80 GNUNET_assert (b != NULL); 73 GNUNET_assert (b != NULL);
81 WANT (buf, b); 74 WANT (buf, b);
@@ -92,15 +85,15 @@ check ()
92 at.abs_value = 5000; 85 at.abs_value = 5000;
93 r = GNUNET_STRINGS_absolute_time_to_string (at); 86 r = GNUNET_STRINGS_absolute_time_to_string (at);
94 /* r should be something like "Wed Dec 31 17:00:05 1969" 87 /* r should be something like "Wed Dec 31 17:00:05 1969"
95 where the details of the day and hour depend on the timezone; 88 * where the details of the day and hour depend on the timezone;
96 however, the "0:05 19" should always be there; hence: */ 89 * however, the "0:05 19" should always be there; hence: */
97 if (NULL == strstr (r, "0:05 19")) 90 if (NULL == strstr (r, "0:05 19"))
98 { 91 {
99 fprintf (stderr, "Got %s\n", r); 92 fprintf (stderr, "Got %s\n", r);
100 GNUNET_break (0); 93 GNUNET_break (0);
101 GNUNET_free (r); 94 GNUNET_free (r);
102 return 1; 95 return 1;
103 } 96 }
104 GNUNET_free (r); 97 GNUNET_free (r);
105 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); 98 b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII");
106 WANT ("TEST", b); 99 WANT ("TEST", b);