diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-06-28 14:15:44 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-06-29 18:25:44 +0000 |
commit | b9a75d98b2c0107684bfb5a127eabba5bbb3b2b3 (patch) | |
tree | 7cc3105079dec7545acdfa82067c707ab8331b4f | |
parent | 86a6b17555cadcc9528429cc24278b13f30c7b2b (diff) |
Remove broken conference tests.
These display some idea, but the tests are not implemented correctly. We
will need to implement the idea correctly later, but for now we can't use
these.
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | auto_tests/BUILD.bazel | 2 | ||||
-rw-r--r-- | auto_tests/monolith_test.cc | 8 | ||||
-rw-r--r-- | auto_tests/self_conference_title_change_test.c | 88 | ||||
-rw-r--r-- | auto_tests/selfname_change_conference_test.c | 94 | ||||
-rw-r--r-- | testing/BUILD.bazel | 4 |
6 files changed, 5 insertions, 195 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 715160cf..cd05ad70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -515,10 +515,6 @@ auto_test(tox_one) | |||
515 | auto_test(tox_strncasecmp) | 515 | auto_test(tox_strncasecmp) |
516 | auto_test(typing) | 516 | auto_test(typing) |
517 | auto_test(version) | 517 | auto_test(version) |
518 | # TODO(iphydf): These tests are broken. The code needs to be fixed, as the | ||
519 | # tests themselves are correct. | ||
520 | auto_test(selfname_change_conference DONT_RUN) | ||
521 | auto_test(self_conference_title_change DONT_RUN) | ||
522 | 518 | ||
523 | if(BUILD_TOXAV) | 519 | if(BUILD_TOXAV) |
524 | auto_test(toxav_basic) | 520 | auto_test(toxav_basic) |
diff --git a/auto_tests/BUILD.bazel b/auto_tests/BUILD.bazel index af8920b1..7b0cab7d 100644 --- a/auto_tests/BUILD.bazel +++ b/auto_tests/BUILD.bazel | |||
@@ -33,7 +33,7 @@ cc_library( | |||
33 | cc_test( | 33 | cc_test( |
34 | name = "monolith_test", | 34 | name = "monolith_test", |
35 | size = "small", | 35 | size = "small", |
36 | srcs = ["monolith_test.cpp"], | 36 | srcs = ["monolith_test.cc"], |
37 | copts = ["-Wno-sign-compare"], | 37 | copts = ["-Wno-sign-compare"], |
38 | deps = [ | 38 | deps = [ |
39 | ":helpers", | 39 | ":helpers", |
diff --git a/auto_tests/monolith_test.cc b/auto_tests/monolith_test.cc index 9fa7ee26..d89c7625 100644 --- a/auto_tests/monolith_test.cc +++ b/auto_tests/monolith_test.cc | |||
@@ -89,14 +89,6 @@ namespace save_load_test { | |||
89 | int main(void); | 89 | int main(void); |
90 | #include "save_load_test.c" | 90 | #include "save_load_test.c" |
91 | } // namespace save_load_test | 91 | } // namespace save_load_test |
92 | namespace selfname_change_conference_test { | ||
93 | int main(void); | ||
94 | #include "selfname_change_conference_test.c" | ||
95 | } // namespace selfname_change_conference_test | ||
96 | namespace self_conference_title_change_test { | ||
97 | int main(void); | ||
98 | #include "self_conference_title_change_test.c" | ||
99 | } // namespace self_conference_title_change_test | ||
100 | namespace send_message_test { | 92 | namespace send_message_test { |
101 | int main(void); | 93 | int main(void); |
102 | #include "send_message_test.c" | 94 | #include "send_message_test.c" |
diff --git a/auto_tests/self_conference_title_change_test.c b/auto_tests/self_conference_title_change_test.c deleted file mode 100644 index 706c1338..00000000 --- a/auto_tests/self_conference_title_change_test.c +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* self_conference_title_change.c | ||
2 | * | ||
3 | * Small test for checking if obtaining savedata, saving it to disk and using | ||
4 | * works correctly. | ||
5 | * | ||
6 | * Copyright (C) 2017 Tox project All Rights Reserved. | ||
7 | * | ||
8 | * This file is part of Tox. | ||
9 | * | ||
10 | * Tox is free software: you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation, either version 3 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * Tox is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
22 | * | ||
23 | */ | ||
24 | #ifndef _XOPEN_SOURCE | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | #endif | ||
27 | |||
28 | #include <stdio.h> | ||
29 | #include <stdlib.h> | ||
30 | #include <string.h> | ||
31 | #include <time.h> | ||
32 | |||
33 | #include "../toxcore/tox.h" | ||
34 | #include "../toxencryptsave/toxencryptsave.h" | ||
35 | |||
36 | #include "helpers.h" | ||
37 | |||
38 | static const char *newtitle = "kitten over darknet"; | ||
39 | |||
40 | static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title, | ||
41 | size_t length, void *user_data) | ||
42 | { | ||
43 | if (!memcmp(title, newtitle, tox_conference_get_title_size(tox, conference_number, nullptr))) { | ||
44 | printf("success: title was changed and updated in the conference"); | ||
45 | exit(0); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | int main(void) | ||
50 | { | ||
51 | setvbuf(stdout, nullptr, _IONBF, 0); | ||
52 | |||
53 | uint32_t conference_number; | ||
54 | struct Tox_Options *to = tox_options_new(nullptr); | ||
55 | Tox *t; | ||
56 | TOX_ERR_CONFERENCE_NEW conference_err; | ||
57 | TOX_ERR_CONFERENCE_TITLE title_err; | ||
58 | |||
59 | t = tox_new_log(to, nullptr, nullptr); | ||
60 | tox_options_free(to); | ||
61 | |||
62 | tox_callback_conference_title(t, &cbtitlechange); | ||
63 | |||
64 | if ((conference_number = tox_conference_new(t, &conference_err)) == UINT32_MAX) { | ||
65 | tox_kill(t); | ||
66 | fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err); | ||
67 | return 2; | ||
68 | } | ||
69 | |||
70 | tox_iterate(t, nullptr); | ||
71 | c_sleep(tox_iteration_interval(t)); | ||
72 | |||
73 | if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) { | ||
74 | tox_kill(t); | ||
75 | fprintf(stderr, "error: could not set conference title, error code %d\n", title_err); | ||
76 | return 3; | ||
77 | } | ||
78 | |||
79 | tox_iterate(t, nullptr); | ||
80 | c_sleep(tox_iteration_interval(t)); | ||
81 | tox_iterate(t, nullptr); | ||
82 | |||
83 | fprintf(stderr, "error: title was not changed in callback. exiting.\n"); | ||
84 | |||
85 | tox_kill(t); | ||
86 | |||
87 | return 1; | ||
88 | } | ||
diff --git a/auto_tests/selfname_change_conference_test.c b/auto_tests/selfname_change_conference_test.c deleted file mode 100644 index dadfbeb6..00000000 --- a/auto_tests/selfname_change_conference_test.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* selfname_change_conference_test.c | ||
2 | * | ||
3 | * Small test for checking if obtaining savedata, saving it to disk and using | ||
4 | * works correctly. | ||
5 | * | ||
6 | * Copyright (C) 2017 Tox project All Rights Reserved. | ||
7 | * | ||
8 | * This file is part of Tox. | ||
9 | * | ||
10 | * Tox is free software: you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation, either version 3 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * Tox is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
22 | * | ||
23 | */ | ||
24 | #ifndef _XOPEN_SOURCE | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | #endif | ||
27 | |||
28 | #include <stdio.h> | ||
29 | #include <stdlib.h> | ||
30 | #include <string.h> | ||
31 | #include <time.h> | ||
32 | |||
33 | #include "helpers.h" | ||
34 | |||
35 | #include "../toxcore/tox.h" | ||
36 | #include "../toxencryptsave/toxencryptsave.h" | ||
37 | |||
38 | static const char *newname = "chris"; | ||
39 | |||
40 | static void cbconfmembers(Tox *tox, uint32_t conference_number, uint32_t peer_number, | ||
41 | const uint8_t *name, size_t length, | ||
42 | void *user_data) | ||
43 | { | ||
44 | uint8_t new_peer_name[TOX_MAX_NAME_LENGTH + 1]; | ||
45 | |||
46 | if (!tox_conference_peer_get_name(tox, conference_number, peer_number, new_peer_name, nullptr)) { | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | if (!memcmp(newname, new_peer_name, tox_conference_peer_get_name_size(tox, conference_number, peer_number, nullptr))) { | ||
51 | printf("success: own name was changed and updated in the conference"); | ||
52 | exit(0); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | int main(void) | ||
57 | { | ||
58 | setvbuf(stdout, nullptr, _IONBF, 0); | ||
59 | |||
60 | struct Tox_Options *to = tox_options_new(nullptr); | ||
61 | Tox *t; | ||
62 | TOX_ERR_CONFERENCE_NEW conference_err; | ||
63 | TOX_ERR_SET_INFO name_err; | ||
64 | |||
65 | t = tox_new_log(to, nullptr, nullptr); | ||
66 | tox_options_free(to); | ||
67 | |||
68 | tox_callback_conference_peer_name(t, cbconfmembers); | ||
69 | |||
70 | if (tox_conference_new(t, &conference_err) == UINT32_MAX) { | ||
71 | tox_kill(t); | ||
72 | fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err); | ||
73 | return 2; | ||
74 | } | ||
75 | |||
76 | tox_iterate(t, nullptr); | ||
77 | c_sleep(tox_iteration_interval(t)); | ||
78 | |||
79 | if (!tox_self_set_name(t, (const uint8_t *)newname, strlen(newname), &name_err)) { | ||
80 | tox_kill(t); | ||
81 | fprintf(stderr, "error: could not set own name, error code %d\n", name_err); | ||
82 | return 3; | ||
83 | } | ||
84 | |||
85 | tox_iterate(t, nullptr); | ||
86 | c_sleep(tox_iteration_interval(t)); | ||
87 | tox_iterate(t, nullptr); | ||
88 | |||
89 | fprintf(stderr, "error: name was not changed in callback. exiting.\n"); | ||
90 | |||
91 | tox_kill(t); | ||
92 | |||
93 | return 1; | ||
94 | } | ||
diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 075f00d1..117eb69d 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel | |||
@@ -30,6 +30,10 @@ cc_binary( | |||
30 | cc_binary( | 30 | cc_binary( |
31 | name = "av_test", | 31 | name = "av_test", |
32 | srcs = ["av_test.c"], | 32 | srcs = ["av_test.c"], |
33 | # We must always optimise this program, because otherwise GCC won't inline | ||
34 | # cvArcLength but also not emit it out of line, resulting in undefined | ||
35 | # reference errors. | ||
36 | copts = ["-O1"], | ||
33 | deps = [ | 37 | deps = [ |
34 | "//c-toxcore/toxav", | 38 | "//c-toxcore/toxav", |
35 | "//c-toxcore/toxav:monolith", | 39 | "//c-toxcore/toxav:monolith", |