- Timestamp:
- 2007-10-12T00:06:50Z (17 years ago)
- Branches:
- master
- Children:
- 3933853, c78c032, eda54e4
- Parents:
- 285b55d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/check_util.c
r285b55d rd444c09 104 104 END_TEST 105 105 106 struct 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 147 START_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 } 161 END_TEST 162 106 163 Suite *util_suite (void) 107 164 { … … 116 173 tcase_add_test (tc_core, test_set_url_username); 117 174 tcase_add_test (tc_core, test_set_url_username_pwd); 175 tcase_add_test (tc_core, test_word_wrap); 118 176 return s; 119 177 }
Note: See TracChangeset
for help on using the changeset viewer.