Skip to content

Commit

Permalink
Clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
btrkeks committed May 19, 2024
1 parent b704683 commit 11de75c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/ankiconnectc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

typedef size_t (*ResponseFunc)(char *ptr, size_t len, size_t nmemb, void *userdata);


static int get_array_len(const char *array[static 1]) {
int n = 0;
while (*array++)
Expand Down
15 changes: 9 additions & 6 deletions tests/ankiconnect_tests.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

#include "util.h"
#include "ankiconnectc.c"
#include "util.h"

TestSuite *ankiconnect_tests(void);

Describe(AnkiConnectC);
BeforeEach(AnkiConnectC) {}
AfterEach(AnkiConnectC) {}

BeforeEach(AnkiConnectC) {
}
AfterEach(AnkiConnectC) {
}

Ensure(AnkiConnectC, sends_correct_guiBrowse_request) {
_drop_(frees8) s8 received = form_gui_search_req("Japanese", "VocabKanji", "面白い");
s8 expected = S("{ \"action\": \"guiBrowse\", \"version\": 6, \"params\": { \"query\" : \"\\\"deck:Japanese\\\" \\\"VocabKanji:面白い\\\"\" } }");
s8 expected = S(
"{ \"action\": \"guiBrowse\", \"version\": 6, \"params\": { \"query\" : \"\\\"deck:Japanese\\\" \\\"VocabKanji:面白い\\\"\" } }");
assert_that(received.s, is_equal_to_string((const char *)expected.s));
}

Ensure(AnkiConnectC, sends_correct_search_request) {
_drop_(frees8) s8 received = form_search_req(false, "Japanese", "VocabKanji", "敷衍");
s8 expected = S("{ \"action\": \"findCards\", \"version\": 6, \"params\": { \"query\" : \"\\\"deck:Japanese\\\" \\\"VocabKanji:敷衍\\\" -is:suspended\" } }");
s8 expected = S(
"{ \"action\": \"findCards\", \"version\": 6, \"params\": { \"query\" : \"\\\"deck:Japanese\\\" \\\"VocabKanji:敷衍\\\" -is:suspended\" } }");
assert_that(received.s, is_equal_to_string((const char *)expected.s));
}

Expand Down

0 comments on commit 11de75c

Please sign in to comment.