|
13 | 13 | #include "intern.h" |
14 | 14 | #include "numarray.h" |
15 | 15 | #include "routines.h" |
| 16 | +#include "routines_p.h" |
16 | 17 | #include "vstring.h" |
17 | 18 | #include <string.h> |
18 | 19 |
|
@@ -277,6 +278,31 @@ static void test_routines_strrstr(void) |
277 | 278 | TEST_CHECK(strcmp(strrstr("abcdcdb", "cd"), "cdb") == 0); |
278 | 279 | } |
279 | 280 |
|
| 281 | +static void test_routines_baseFilenameSansExtensionNew(void) |
| 282 | +{ |
| 283 | + char *bs; |
| 284 | + |
| 285 | + TEST_CHECK ((bs = baseFilenameSansExtensionNew ("a.in", ".in")) |
| 286 | + && strcmp(bs, "a") == 0); |
| 287 | + if (bs) |
| 288 | + eFree (bs); |
| 289 | + |
| 290 | + TEST_CHECK ((bs = baseFilenameSansExtensionNew ("x/b.in", ".in")) |
| 291 | + && strcmp(bs, "b") == 0); |
| 292 | + if (bs) |
| 293 | + eFree (bs); |
| 294 | + |
| 295 | + TEST_CHECK ((bs = baseFilenameSansExtensionNew ("c.in.in", ".in.in")) |
| 296 | + && strcmp(bs, "c") == 0); |
| 297 | + if (bs) |
| 298 | + eFree (bs); |
| 299 | + |
| 300 | + TEST_CHECK ((bs = baseFilenameSansExtensionNew ("/y/d.in.in", ".in.in")) |
| 301 | + && strcmp(bs, "d") == 0); |
| 302 | + if (bs) |
| 303 | + eFree (bs); |
| 304 | +} |
| 305 | + |
280 | 306 | static void test_vstring_ncats(void) |
281 | 307 | { |
282 | 308 | vString *vstr = vStringNew (); |
@@ -351,6 +377,7 @@ TEST_LIST = { |
351 | 377 | { "intern", test_intern }, |
352 | 378 | { "numarray", test_numarray }, |
353 | 379 | { "routines/strrstr", test_routines_strrstr }, |
| 380 | + { "routines/baseFilenameSansExtensionNew", test_routines_baseFilenameSansExtensionNew }, |
354 | 381 | { "vstring/ncats", test_vstring_ncats }, |
355 | 382 | { "vstring/truncate_leading", test_vstring_truncate_leading }, |
356 | 383 | { "vstring/EqC", test_vstring_eqc }, |
|
0 commit comments