| 1 |
/* |
| 2 |
* boxes - Command line filter to draw/remove ASCII boxes around text |
| 3 |
* Copyright (c) 1999-2024 Thomas Jensen and the boxes contributors |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public |
| 6 |
* License, version 3, as published by the Free Software Foundation. |
| 7 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 8 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 9 |
* details. |
| 10 |
* You should have received a copy of the GNU General Public License along with this program. |
| 11 |
* If not, see <https://www.gnu.org/licenses/>. |
| 12 |
* |
| 13 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 14 |
*/ |
| 15 |
|
| 16 |
/* |
| 17 |
* Unit tests of the 'remove' module |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef REMOVE_TEST_H |
| 21 |
#define REMOVE_TEST_H |
| 22 |
|
| 23 |
#include "bxstring.h" |
| 24 |
#include "remove.h" |
| 25 |
|
| 26 |
|
| 27 |
/* defined here and not in remove.h because these functions are only visible for testing */ |
| 28 |
match_result_t *match_outer_shape(int vside, bxstr_t *input_line, bxstr_t *shape_line); |
| 29 |
int hmm(shape_line_ctx_t *shapes_relevant, uint32_t *cur_pos, size_t shape_idx, uint32_t *end_pos, int anchored_left, |
| 30 |
int anchored_right); |
| 31 |
uint32_t *shorten(shape_line_ctx_t *shape_line_ctx, size_t *quality, int prefer_left, int allow_left, int allow_right); |
| 32 |
void toblank_mixed(bxstr_t *org_line, uint32_t **s, size_t from, size_t to); |
| 33 |
|
| 34 |
|
| 35 |
void test_match_outer_shape_null(void **state); |
| 36 |
void test_match_outer_shape_left_anchored(void **state); |
| 37 |
void test_match_outer_shape_left_shiftable(void **state); |
| 38 |
void test_match_outer_shape_left_shortened(void **state); |
| 39 |
void test_match_outer_shape_left_not_found(void **state); |
| 40 |
void test_match_outer_shape_left_too_far_in(void **state); |
| 41 |
void test_match_outer_shape_left_edge(void **state); |
| 42 |
void test_match_outer_shape_right_anchored(void **state); |
| 43 |
void test_match_outer_shape_right_shiftable(void **state); |
| 44 |
void test_match_outer_shape_right_shortened(void **state); |
| 45 |
void test_match_outer_shape_right_shortened2(void **state); |
| 46 |
void test_match_outer_shape_right_not_found(void **state); |
| 47 |
void test_match_outer_shape_right_too_far_in(void **state); |
| 48 |
void test_match_outer_shape_right_edge(void **state); |
| 49 |
|
| 50 |
void test_shorten_preferleft_allowall(void **state); |
| 51 |
void test_shorten_preferleft_allowright(void **state); |
| 52 |
void test_shorten_preferleft_allowleft(void **state); |
| 53 |
void test_shorten_preferright_allowall(void **state); |
| 54 |
void test_shorten_corner_cases(void **state); |
| 55 |
|
| 56 |
void test_hmm_sunny_day(void **state); |
| 57 |
void test_hmm_sunny_day_short(void **state); |
| 58 |
void test_hmm_missing_elastic_nne(void **state); |
| 59 |
void test_hmm_invalid_input(void **state); |
| 60 |
void test_hmm_empty_shapes_success(void **state); |
| 61 |
void test_hmm_backtracking(void **state); |
| 62 |
void test_hmm_shiftable(void **state); |
| 63 |
void test_hmm_shortened(void **state); |
| 64 |
void test_hmm_shortened_right_fail(void **state); |
| 65 |
void test_hmm_shortened_right(void **state); |
| 66 |
void test_hmm_blank_shiftable(void **state); |
| 67 |
void test_hmm_blank(void **state); |
| 68 |
|
| 69 |
|
| 70 |
#endif |
| 71 |
|
| 72 |
|
| 73 |
/* vim: set cindent sw=4: */ |