/** Test funkcji dictionary_find(). Wyszukanie pięciu słów, wstawionych wczęsniej. */ static void dictionary_find_test(void** state) { struct dictionary *dict = *state; assert_true(dictionary_find(dict, first)); assert_true(dictionary_find(dict, second)); assert_true(dictionary_find(dict, third)); assert_true(dictionary_find(dict, first)); assert_true(dictionary_find(dict, fifth)); }
void check_keys(dictionary const *d){ char *got_it = dictionary_find(d, "xx"); g_assert(got_it == dictionary_not_found); got_it = dictionary_find(d, "key1"); g_assert_cmpstr(got_it, ==, "val1"); got_it = dictionary_find(d, "key2"); g_assert_cmpstr(got_it, ==, NULL); }
/** Testuje dictionary_delete @param[in,out] state Środowisko */ static void dictionary_delete_test(void **state) { dictionary *dict = *state; const wchar_t *word = L"abc"; dictionary_insert(dict, word); assert_true(dictionary_find(dict, word)); dictionary_delete(dict, word); assert_false(dictionary_find(dict, word)); }
/** Test funkcji dictionary_delete(). Usuwanie wstawionych słów i próba usunięcia nieistniejących. */ static void dictionary_delete_test(void** state) { struct dictionary *dict = *state; assert_true(dictionary_find(dict, first)); dictionary_delete(dict, first); assert_false(dictionary_find(dict, first)); dictionary_insert(dict,first); assert_true(dictionary_find(dict, first)); dictionary_delete(dict, second); assert_false(dictionary_find(dict, second)); assert_true(dictionary_find(dict, third)); }
/** Testuje wyszukiwanie w słowniku. @param state Środowisko testowe. */ static void dictionary_find_test(void** state) { dictionary_setup(state); struct dictionary *dict = *state; assert_true(dictionary_find(dict, L"féin")); assert_false(dictionary_find(dict, L"fein")); dictionary_teardown(state); }
/** Testuje dictionary_find @param[in,out] state Środowisko */ static void dictionary_find_test(void **state) { dictionary *dict = *state; const wchar_t *word = L"abc"; const wchar_t *word1 = L"abc^"; const wchar_t *word2 = L"abca"; const wchar_t *word3 = L"ab"; assert_false(dictionary_find(dict, word)); dictionary_insert(dict, word); assert_true(dictionary_find(dict, word)); assert_true(dictionary_find(dict, word1)); assert_false(dictionary_find(dict, word2)); assert_false(dictionary_find(dict, word3)); }
/** Test funkcji dictionary_insert(). Wstawienie pięciu słów do słownika. */ static int dictionary_insert_test(void** state) { struct dictionary *dict; dict = dictionary_new(); if (!dict) return -1; dictionary_insert(dict, first); assert_true(dictionary_find(dict, first)); assert_false(dictionary_find(dict,second)); dictionary_insert(dict, second); dictionary_insert(dict, third); dictionary_insert(dict, fourth); dictionary_insert(dict, fifth); *state = dict; return 0; }
/// Testuje dodawanie słów do słownika po wszystkich ścieżkach drzewa. static void dict_insert_test(void** state) { struct dictionary* d = *state; assert_int_equal(dictionary_insert(d, L""), 0); assert_int_equal(dictionary_insert(d, L"x"), 1); assert_int_equal(dictionary_find(d, L"x"), 1); assert_int_equal(dictionary_insert(d, L"az"), 1); assert_int_equal(dictionary_find(d, L"az"), 1); assert_int_equal(dictionary_insert(d, L"axa"), 1); assert_int_equal(dictionary_find(d, L"axa"), 1); assert_int_equal(dictionary_insert(d, L"aya"), 1); assert_int_equal(dictionary_find(d, L"aya"), 1); assert_int_equal(dictionary_insert(d, L"bm"), 1); assert_int_equal(dictionary_find(d, L"bm"), 1); assert_int_equal(dictionary_insert(d, L"bmw"), 1); assert_int_equal(dictionary_find(d, L"bmw"), 1); assert_int_equal(dictionary_insert(d, L"cd"), 1); assert_int_equal(dictionary_find(d, L"cd"), 1); assert_int_equal(dictionary_insert(d, L"cpr"), 1); assert_int_equal(dictionary_find(d, L"cpr"), 1); assert_int_equal(dictionary_insert(d, L"cpqt"), 1); assert_int_equal(dictionary_find(d, L"cpqt"), 1); assert_int_equal(dictionary_insert(d, L"c"), 0); assert_int_equal(dictionary_insert(d, L"C"), 0); assert_int_equal(dictionary_insert(d, L"ax"), 0); assert_int_equal(dictionary_insert(d, L"Ax"), 0); assert_int_equal(dictionary_insert(d, L"AX"), 0); assert_int_equal(dictionary_insert(d, L"aX"), 0); assert_int_equal(dictionary_insert(d, L"Cpq"), 0); assert_int_equal(dictionary_insert(d, L"cPq"), 0); assert_int_equal(dictionary_insert(d, L"cpQ"), 0); assert_int_equal(dictionary_insert(d, L"CPq"), 0); assert_int_equal(dictionary_insert(d, L"CpQ"), 0); assert_int_equal(dictionary_insert(d, L"cPQ"), 0); assert_int_equal(dictionary_insert(d, L"CPQ"), 0); assert_int_equal(dictionary_insert(d, L"b"), 0); assert_int_equal(dictionary_insert(d, L"B"), 0); }
/** Kolorowanie słów. Słowa nie znajdujące się w słowniku - potencjalnie błędne - zostają oznaczone na czerwono. */ static void show_errors() { GtkTextIter start, end, text_end; int i, range; char *word; gunichar *wword; gtk_text_buffer_create_tag(editor_buf, "red_fg", "foreground", "red", "weight", PANGO_WEIGHT_BOLD, NULL); gtk_text_buffer_get_end_iter(editor_buf, &text_end); gtk_text_buffer_get_start_iter(editor_buf, &end); range = gtk_text_buffer_get_char_count(editor_buf); while (!gtk_text_iter_is_end(&end)) { gtk_text_iter_forward_word_end(&end); start = end; gtk_text_iter_backward_word_start(&start); word = gtk_text_iter_get_text(&start, &end); wword = g_utf8_to_ucs4_fast(word, -1, NULL); if (make_lowercase(wword)) { if (!dictionary_find(dict, wword)) gtk_text_buffer_apply_tag_by_name(editor_buf, "red_fg", &start, &end); } g_free(word); g_free(wword); } }
/** * Funkcja, która finalizuje wczytywanie słowa i wypisuje o nim informacje. * Na standardowe wyjście słowo zostaje przepisane, lub przepisane poprzedzone * znakiem '#', jeśli go nie znaleziono w słowniku. * Jeśli w 'pstate' ustawiony jest tryb "verbose", wypisywane są również * dodatkowe informacje o podpowiedziach na wyjście błędów. * @param [in,out] pstate Stan parsera. Zostanie uaktualniona jedynie pozycja * w buforze. */ void process_word(struct parser_state * pstate) { // finalizing buffer iterator *pstate->buffer_iterator = L'\0'; pstate->buffer_iterator = word_buffer; // word for dictionary make_lower(word_buffer, word_buffer_lowered); // true position of the word int word_column_num = pstate->last_non_word_column_num + 1; // getting data from dictionary and printing it const bool is_in_dict = dictionary_find(pstate->dict, word_buffer_lowered); if (!is_in_dict && pstate->verbose) { { struct word_list wlist; dictionary_hints(pstate->dict, word_buffer_lowered, &wlist); print_verbose_info(pstate, word_column_num, &wlist, stderr); } fputwc(L'#', stdout); } fputws(word_buffer, stdout); }
/** Przetwarza jedno słowo @param[in,out] index Indeks znaku w buforze @param[in,out] char_number Nr znaku w aktualnie przetwarzanej linii @param[in,out] line_number Nr linii przetwarzanej @param[in] buffer Bufor @param[in] dict Słownik @param[in] v_option Czy włączono opcję -v */ void parse_word(int *index, int *char_number, int *line_number, wchar_t *buffer, struct dictionary *dict, bool v_option) { const int first_char = *char_number; vector *word = vector_new(sizeof(wchar_t), BUFFER_START_SIZE); for(; iswalpha(buffer[*index]); (*index)++, (*char_number)++) vector_push_back(word, buffer + *index); vector_push_back(word, L"\0"); (*index)--; (*char_number)--; wchar_t *word_content = vector_content(word); wchar_t *word_small = malloc(vector_size(word) * sizeof(wchar_t)); for(int i = 0; i < vector_size(word); i++) word_small[i] = towlower(word_content[i]); if(!dictionary_find(dict, word_small)) { wprintf(L"#"); if(v_option) { fwprintf(stderr, L"%d,%d %ls:", *line_number, first_char, word_content); struct word_list list; dictionary_hints(dict, word_small, &list); const wchar_t * const *hints = word_list_get(&list); int number_of_hints = word_list_size(&list); for(int i = 0; i < number_of_hints; i++) fwprintf(stderr, L" %ls", hints[i]); if(number_of_hints == 0) fwprintf(stderr, L" "); fwprintf(stderr, L"\n"); } } wprintf(L"%ls", word_content); free(word_small); vector_done(word); }
/** Testuje wczytywanie drzewa. @param state Środowisko testowe. */ static void dictionary_load_test(void** state) { struct dictionary *dict = NULL; push_word_to_io_mock(L"ciupagą*^^^^^^^\n13\na*b*3*2\n"); dict = dictionary_load(stdin); pop_remaining_chars(); assert_non_null(dict); assert_true(dictionary_find(dict, L"ciupagą")); assert_int_equal(dictionary_hints_max_cost(dict, 2), 13); dictionary_done(dict); }
int dictionary_delete(struct dictionary *dict, const wchar_t *word) { if (dict == NULL || word == NULL) return 0; if (dictionary_find(dict, word)) { struct dictionary *found = NULL; find_child(dict, &found, *word); delete_helper(found, NULL, word); return 1; } return 0; }
void dictionary_hints(const struct dictionary *dict, const wchar_t* word, struct word_list *list) { word_list_init(list); int *n; wchar_t **hints; possible_hints(dict, word, &n, &hints); for (int i = 0; i < *n; i++) if (dictionary_find(dict, hints[i]) && !word_list_find(list, hints[i])) word_list_add(list, hints[i]); for (int i = 0; i < *n; i++) free(hints[i]); }
bool dictionary_find(const struct dictionary *dict, const wchar_t *word) { if (dict == NULL) return false; struct dictionary *found = NULL; if (*word == L'\0') { return find_child(dict, &found, NULL_MARKER); } else { find_child(dict, &found, *word); word++; return dictionary_find(found, word); } }
/** Testuje wstawianie do słownika. @param state Środowisko testowe. */ static void dictionary_insert_test(void** state) { struct dictionary *dict = dictionary_new(); size_t n_words = 4; wchar_t *words[] = {L"wątły", L"wątły", L"wątlejszy", L"łódka"}; for (size_t i = 0; i < n_words; i++) { if (i == 1) assert_false(dictionary_insert(dict, words[i])); else assert_true(dictionary_insert(dict, words[i])); } for (size_t i = 0; i < n_words; i++) assert_true(dictionary_find(dict, words[i])); dictionary_done(dict); }
// Koloruje słowa nie ze słownika na czerwono static void ColorMistakes (GtkMenuItem *item, gpointer data) { GtkTextIter start, end, buffEnd; gtk_text_buffer_get_start_iter(editor_buf, &end); //Teraz sztuczką przesuwamy końcowy iterator na koniec ostatniego słowa gtk_text_buffer_get_end_iter(editor_buf, &buffEnd); gtk_text_iter_backward_word_start(&buffEnd); gtk_text_iter_forward_word_end(&buffEnd); gtk_text_buffer_create_tag(editor_buf, "red_fg", "foreground", "red", "weight", PANGO_WEIGHT_BOLD, NULL); // Aktualizacja słownika if(update_actual_dict() < 0) return; start = end; while (!gtk_text_iter_equal(&end, &buffEnd)) { // Inkrementacja zmiennych gtk_text_iter_forward_word_end(&end); start = end; gtk_text_iter_backward_word_start(&start); // Usuwamy etykietkę ze słowa jeśli jest gtk_text_buffer_remove_tag_by_name(editor_buf, "red_fg", &start, &end); // Separujemy słowo char* word = gtk_text_iter_get_text(&start, &end); gunichar* wword = g_utf8_to_ucs4_fast(word, -1, NULL); // Jeśli znaleziono w słowniku to kolorujemy if(!dictionary_find(dict, (const wchar_t*)wword)) gtk_text_buffer_apply_tag_by_name(editor_buf, "red_fg", &start, &end); g_free(word); } }
/** Sprawdzenie słowa, na którym aktualnie znajduje się kursor. Ewentualne dodanie do słownika. @param[in] item element menu. @param[in] data wskaźnik na wartość. */ static void WhatCheck (GtkMenuItem *item, gpointer data) { GtkWidget *dialog; GtkTextIter start, end; char *word; gunichar *wword; //load_dictionary_from_menu(&dict); // Znajdujemy pozycję kursora gtk_text_buffer_get_iter_at_mark(editor_buf, &start, gtk_text_buffer_get_insert(editor_buf)); // Jeśli nie wewnątrz słowa, kończymy if (!gtk_text_iter_inside_word(&start)) { dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Kursor musi być w środku słowa"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return; } // Znajdujemy początek i koniec słowa, a potem samo słowo end = start; gtk_text_iter_backward_word_start(&start); gtk_text_iter_forward_word_end(&end); word = gtk_text_iter_get_text(&start, &end); // Zamieniamy na wide char (no prawie) wword = g_utf8_to_ucs4_fast(word, -1, NULL); if (!make_lowercase(wword)) { dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Podane słowo nie jest słowem słownikowym."); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } else { // Sprawdzamy if (dictionary_find(dict, (wchar_t *)wword)) { dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Wszystko w porządku,\nśpij spokojnie"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } else { // Czas korekty GtkWidget *vbox, *label, *combo; struct word_list hints; int i; wchar_t **words; dictionary_hints(dict, (wchar_t *)wword, &hints); words = (wchar_t **) word_list_get(&hints); dialog = gtk_dialog_new_with_buttons("Korekta", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_ADD, GTK_RESPONSE_APPLY, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); // W treści dialogu dwa elementy vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); // Tekst label = gtk_label_new("Słowo nie znajduje się w słowniku. Wybierz \njedną z propozycji lub dodaj słowa do słownika."); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 1); // Spuszczane menu combo = gtk_combo_box_text_new(); for (i = 0; i < word_list_size(&hints); i++) { // Combo box lubi mieć Gtk char *uword = g_ucs4_to_utf8((gunichar *)words[i], -1, NULL, NULL, NULL); // Dodajemy kolejny element gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), uword); g_free(uword); } gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 1); gtk_widget_show(combo); gint click = gtk_dialog_run(GTK_DIALOG(dialog)); if (click == GTK_RESPONSE_ACCEPT) { char *korekta = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo)); // Usuwamy stare gtk_text_buffer_delete(editor_buf, &start, &end); // Wstawiamy nowe gtk_text_buffer_insert(editor_buf, &start, korekta, -1); g_free(korekta); } // Proponujemy dodanie słowa do słownika else if (click == GTK_RESPONSE_APPLY) dictionary_insert(dict, wword); gtk_widget_destroy(dialog); } } g_free(word); g_free(wword); }
/// Test na znajdowanie słów w słowniku. static void dict_find_test(void **state) { struct dictionary* d = *state; assert_non_null(d); assert_int_equal(dictionary_find(d, L""), 0); assert_int_equal(dictionary_find(d, L"x"), 0); assert_int_equal(dictionary_find(d, L"az"), 0); assert_int_equal(dictionary_find(d, L"axa"), 0); assert_int_equal(dictionary_find(d, L"aya"), 0); assert_int_equal(dictionary_find(d, L"bm"), 0); assert_int_equal(dictionary_find(d, L"bmw"), 0); assert_int_equal(dictionary_find(d, L"cd"), 0); assert_int_equal(dictionary_find(d, L"cpr"), 0); assert_int_equal(dictionary_find(d, L"cpqt"), 0); assert_int_equal(dictionary_find(d, L"c"), 1); assert_int_equal(dictionary_find(d, L"C"), 1); assert_int_equal(dictionary_find(d, L"ax"), 1); assert_int_equal(dictionary_find(d, L"Ax"), 1); assert_int_equal(dictionary_find(d, L"AX"), 1); assert_int_equal(dictionary_find(d, L"aX"), 1); assert_int_equal(dictionary_find(d, L"Cpq"), 1); assert_int_equal(dictionary_find(d, L"cPq"), 1); assert_int_equal(dictionary_find(d, L"cpQ"), 1); assert_int_equal(dictionary_find(d, L"CPq"), 1); assert_int_equal(dictionary_find(d, L"CpQ"), 1); assert_int_equal(dictionary_find(d, L"cPQ"), 1); assert_int_equal(dictionary_find(d, L"CPQ"), 1); assert_int_equal(dictionary_find(d, L"b"), 1); assert_int_equal(dictionary_find(d, L"B"), 1); const wchar_t* veryLong = L"verylongwordnotintreewithpolishcharsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxqwertyuiopąęćńźżół"; assert_int_equal(dictionary_find(d, veryLong), 0); assert_int_equal(dictionary_insert(d, veryLong), 1); assert_int_equal(dictionary_find(d, veryLong), 1); }
static void WhatCheck (GtkMenuItem *item, gpointer data) { GtkWidget *dialog; GtkTextIter start, end; char *word; gunichar *wword; // Znajdujemy pozycję kursora gtk_text_buffer_get_iter_at_mark(editor_buf, &start, gtk_text_buffer_get_insert(editor_buf)); // Jeśli nie wewnątrz słowa, kończymy if (!gtk_text_iter_inside_word(&start)) { dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Kursor musi być w środku słowa"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return; } // Znajdujemy początek i koniec słowa, a potem samo słowo end = start; gtk_text_iter_backward_word_start(&start); gtk_text_iter_forward_word_end(&end); word = gtk_text_iter_get_text(&start, &end); // Zamieniamy na wide char (no prawie) wword = g_utf8_to_ucs4_fast(word, -1, NULL); if(update_actual_dict() < 0) return; // Sprawdzamy if (dictionary_find(dict, (wchar_t *)wword)) { dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Wszystko w porządku,\nśpij spokojnie"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } else { // Czas korekty GtkWidget *vbox, *label, *combo; struct word_list hints; int i; wchar_t **words; dictionary_hints(dict, (wchar_t *)wword, &hints); words = word_list_get(&hints); dialog = gtk_dialog_new_with_buttons("Korekta", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); // W treści dialogu dwa elementy vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); // Tekst label = gtk_label_new("Coś nie tak, mam kilka propozycji"); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 1); // Spuszczane menu combo = gtk_combo_box_text_new(); for (i = 0; i < word_list_size(&hints); i++) { // Combo box lubi mieć Gtk char *uword = g_ucs4_to_utf8((gunichar *)words[i], -1, NULL, NULL, NULL); // Dodajemy kolejny element gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), uword); g_free(uword); } //gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),"<inne...>"); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 1); gtk_widget_show(combo); char *korekta, *question; GtkWidget *ask_dialog, *ask_vbox, *ask_label; switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_ACCEPT: korekta = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo)); // Usuwamy stare gtk_text_buffer_delete(editor_buf, &start, &end); // Wstawiamy nowe gtk_text_buffer_insert(editor_buf, &start, korekta, -1); g_free(korekta); break; case GTK_RESPONSE_REJECT: question = "Czy chcesz dodać to słowo do słownika?"; ask_dialog = gtk_dialog_new_with_buttons(question, NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); ask_vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); // Tekst ask_label = gtk_label_new("Coś nie tak, mam kilka propozycji"); gtk_widget_show(ask_label); gtk_box_pack_start(GTK_BOX(ask_vbox), ask_label, FALSE, FALSE, 1); // Jeśli chiciał dodać nowe słowo do słownika to dodamy i zapiszemy if (gtk_dialog_run(GTK_DIALOG(ask_dialog)) == GTK_RESPONSE_ACCEPT) { dictionary_insert(dict, (wchar_t *)wword); dictionary_save_lang(dict, dict_location); } gtk_widget_destroy(ask_dialog); break; } gtk_widget_destroy(dialog); } }
/// Test na usuwanie słów ze słownika. static void dict_delete_test(void** state) { struct dictionary* d = *state; assert_int_equal(dictionary_delete(d, first), 1); assert_int_equal(dictionary_find(d, first), 0); assert_int_equal(dictionary_insert(d, first), 1); assert_int_equal(dictionary_find(d, first), 1); assert_int_equal(dictionary_delete(d, second), 1); assert_int_equal(dictionary_find(d, second), 0); assert_int_equal(dictionary_insert(d, second), 1); assert_int_equal(dictionary_find(d, second), 1); assert_int_equal(dictionary_delete(d, third), 1); assert_int_equal(dictionary_find(d, third), 0); assert_int_equal(dictionary_insert(d, third), 1); assert_int_equal(dictionary_find(d, third), 1); assert_int_equal(dictionary_delete(d, forth), 1); assert_int_equal(dictionary_find(d, forth), 0); assert_int_equal(dictionary_insert(d, forth), 1); assert_int_equal(dictionary_find(d, forth), 1); assert_int_equal(dictionary_delete(d, fifth), 1); assert_int_equal(dictionary_find(d, fifth), 0); assert_int_equal(dictionary_insert(d, fifth), 1); assert_int_equal(dictionary_find(d, fifth), 1); assert_int_equal(dictionary_delete(d, first), 1); assert_int_equal(dictionary_find(d, first), 0); assert_int_equal(dictionary_delete(d, first), 0); assert_int_equal(dictionary_find(d, first), 0); assert_int_equal(dictionary_insert(d, first), 1); assert_int_equal(dictionary_find(d, first), 1); assert_int_equal(dictionary_delete(d, L""), 0); assert_int_equal(dictionary_delete(d, L"x"), 0); assert_int_equal(dictionary_delete(d, L"az"), 0); assert_int_equal(dictionary_delete(d, L"axa"), 0); assert_int_equal(dictionary_delete(d, L"aya"), 0); assert_int_equal(dictionary_delete(d, L"bm"), 0); assert_int_equal(dictionary_delete(d, L"bmw"), 0); assert_int_equal(dictionary_delete(d, L"cd"), 0); assert_int_equal(dictionary_delete(d, L"cpr"), 0); assert_int_equal(dictionary_delete(d, L"cpqt"), 0); }
static void dictionary_find_test(void** state) { struct dictionary * d = dictionary_new(); dictionary_insert(d, test); assert_true(dictionary_find(d,test)); dictionary_done(d); }
static void dictionary_delete_and_find(void ** state){ struct dictionary *d = *state; dictionary_delete(d,first); assert_true(!dictionary_find(d,first)); }