summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/Messenger_test.c2
-rw-r--r--testing/misc_tools.c44
-rw-r--r--testing/nTox.c2
4 files changed, 47 insertions, 3 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index c4f1e368..58879134 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -30,7 +30,7 @@
30//#include "../core/network.h" 30//#include "../core/network.h"
31#include "../toxcore/DHT.h" 31#include "../toxcore/DHT.h"
32#include "../toxcore/friend_requests.h" 32#include "../toxcore/friend_requests.h"
33#include "../toxcore/misc_tools.h" 33#include "misc_tools.c"
34 34
35#include <string.h> 35#include <string.h>
36 36
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index ad71f4b7..ff34cd4c 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -38,7 +38,7 @@
38 */ 38 */
39 39
40#include "../toxcore/Messenger.h" 40#include "../toxcore/Messenger.h"
41#include "../toxcore/misc_tools.h" 41#include "misc_tools.c"
42 42
43#ifdef WIN32 43#ifdef WIN32
44 44
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
new file mode 100644
index 00000000..6e775867
--- /dev/null
+++ b/testing/misc_tools.c
@@ -0,0 +1,44 @@
1/* misc_tools.c
2 *
3 * Miscellaneous functions and data structures for doing random things.
4 *
5 * Copyright (C) 2013 Tox project All Rights Reserved.
6 *
7 * This file is part of Tox.
8 *
9 * Tox is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Tox is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#include <string.h>
25#include <stdlib.h>
26#include <stdio.h>
27
28#ifdef DEBUG
29#include <assert.h>
30#endif // DEBUG
31
32/* TODO: rewrite */
33unsigned char *hex_string_to_bin(char hex_string[])
34{
35 size_t len = strlen(hex_string);
36 unsigned char *val = malloc(len);
37 char *pos = hex_string;
38 int i;
39
40 for (i = 0; i < len; ++i, pos += 2)
41 sscanf(pos, "%2hhx", &val[i]);
42
43 return val;
44}
diff --git a/testing/nTox.c b/testing/nTox.c
index d86a7739..438468bd 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -38,7 +38,7 @@
38 38
39 39
40#include "nTox.h" 40#include "nTox.h"
41#include "../toxcore/misc_tools.h" 41#include "misc_tools.c"
42 42
43#include <stdio.h> 43#include <stdio.h>
44#include <time.h> 44#include <time.h>