summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorendoffile78 <endoffile78@yahoo.com>2018-08-04 15:56:01 -0500
committeriphydf <iphydf@users.noreply.github.com>2018-08-19 10:38:51 +0000
commit30960dcc7e9661f431d58081d79dc88692bdb50d (patch)
tree56724c62ce9605ec49768b57b16e7333b118310f /testing
parentfc7a5dc4d80ae065a11fa483e619ead02a88e213 (diff)
Add save file generator, save compatibility test, and generate a save file
Diffstat (limited to 'testing')
-rw-r--r--testing/misc_tools.c19
-rw-r--r--testing/misc_tools.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index af6f6872..c9a73b3e 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -85,6 +85,25 @@ uint8_t *hex_string_to_bin(const char *hex_string)
85 return ret; 85 return ret;
86} 86}
87 87
88void to_hex(char *out, uint8_t *in, int size)
89{
90 while (size--) {
91 if (*in >> 4 < 0xA) {
92 *out++ = '0' + (*in >> 4);
93 } else {
94 *out++ = 'A' + (*in >> 4) - 0xA;
95 }
96
97 if ((*in & 0xf) < 0xA) {
98 *out++ = '0' + (*in & 0xF);
99 } else {
100 *out++ = 'A' + (*in & 0xF) - 0xA;
101 }
102
103 in++;
104 }
105}
106
88/* Reimplementation of strncasecmp() function from strings.h, as strings.h is 107/* Reimplementation of strncasecmp() function from strings.h, as strings.h is
89 * POSIX and not portable. Specifically it doesn't exist on MSVC. 108 * POSIX and not portable. Specifically it doesn't exist on MSVC.
90 */ 109 */
diff --git a/testing/misc_tools.h b/testing/misc_tools.h
index b715c8cc..259525a5 100644
--- a/testing/misc_tools.h
+++ b/testing/misc_tools.h
@@ -13,6 +13,7 @@ extern "C" {
13void c_sleep(uint32_t x); 13void c_sleep(uint32_t x);
14 14
15uint8_t *hex_string_to_bin(const char *hex_string); 15uint8_t *hex_string_to_bin(const char *hex_string);
16void to_hex(char *out, uint8_t *in, int size);
16int tox_strncasecmp(const char *s1, const char *s2, size_t n); 17int tox_strncasecmp(const char *s1, const char *s2, size_t n);
17int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled); 18int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled);
18 19