Changeset eda54e4 for tests/check_util.c


Ignore:
Timestamp:
2007-10-12T00:08:58Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a6df0b5
Parents:
82135c7 (diff), d444c09 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from devel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/check_util.c

    r82135c7 reda54e4  
    104104END_TEST
    105105
     106struct
     107{
     108        char *orig;
     109        int line_len;
     110        char *wrapped;
     111} word_wrap_tests[] = {
     112        {
     113                "Line-wrapping is not as easy as it seems?",
     114                16,
     115                "Line-wrapping is\nnot as easy as\nit seems?"
     116        },
     117        {
     118                "Line-wrapping is not as easy as it seems?",
     119                8,
     120                "Line-\nwrapping\nis not\nas easy\nas it\nseems?"
     121        },
     122        {
     123                "Line-wrapping is\nnot as easy as it seems?",
     124                8,
     125                "Line-\nwrapping\nis\nnot as\neasy as\nit\nseems?"
     126        },
     127        {
     128                "a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa",
     129                5,
     130                "a aa\naaa\naaaa\naaaaa\naaaaa\na\naaaaa\naa\naaaaa\naaa",
     131        },
     132        {
     133                "aaaaaaaa aaaaaaa aaaaaa aaaaa aaaa aaa aa a",
     134                5,
     135                "aaaaa\naaa\naaaaa\naa\naaaaa\na\naaaaa\naaaa\naaa\naa a",
     136        },
     137        {
     138                "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
     139                5,
     140                "aaaaa\naaaaa\naaaaa\naaaaa\naaaaa\naaaaa\naaaaa\na",
     141        },
     142        {
     143                NULL
     144        }
     145};
     146
     147START_TEST(test_word_wrap)
     148        int i;
     149       
     150        for( i = 0; word_wrap_tests[i].orig && *word_wrap_tests[i].orig; i ++ )
     151        {
     152                char *wrapped = word_wrap( word_wrap_tests[i].orig, word_wrap_tests[i].line_len );
     153               
     154                fail_unless( strcmp( word_wrap_tests[i].wrapped, wrapped ) == 0,
     155                             "%s (line_len = %d) should wrap to `%s', not to `%s'",
     156                             word_wrap_tests[i].orig, word_wrap_tests[i].line_len,
     157                             word_wrap_tests[i].wrapped, wrapped );
     158               
     159                g_free( wrapped );
     160        }
     161END_TEST
     162
    106163Suite *util_suite (void)
    107164{
     
    116173        tcase_add_test (tc_core, test_set_url_username);
    117174        tcase_add_test (tc_core, test_set_url_username_pwd);
     175        tcase_add_test (tc_core, test_word_wrap);
    118176        return s;
    119177}
Note: See TracChangeset for help on using the changeset viewer.