| 1 |
/** |
| 2 |
* This file is part of the Detox package. |
| 3 |
* |
| 4 |
* Copyright (c) Doug Harple <[email protected]> |
| 5 |
* |
| 6 |
* For the full copyright and license information, please view the LICENSE |
| 7 |
* file that was distributed with this source code. |
| 8 |
*/ |
| 9 |
|
| 10 |
#include <string.h> |
| 11 |
|
| 12 |
// need defines first |
| 13 |
#include "config.h" |
| 14 |
|
| 15 |
#include "clean_string.h" |
| 16 |
|
| 17 |
#include "unit_struct.h" |
| 18 |
|
| 19 |
#define DATA_COUNT 4 |
| 20 |
static struct test_filename data[DATA_COUNT] = { |
| 21 |
|
| 22 |
// legacy tests |
| 23 |
|
| 24 |
{ .filename = "lower", .expected = "lower" }, |
| 25 |
{ .filename = "L0W3R", .expected = "l0w3r" }, |
| 26 |
{ .filename = "UPPER", .expected = "upper" }, |
| 27 |
{ .filename = "UPPer_2", .expected = "upper_2" }, |
| 28 |
|
| 29 |
}; |
| 30 |
|
| 31 |
#test test_clean_lower |
| 32 |
char *output; |
| 33 |
int i; |
| 34 |
|
| 35 |
for (i = 0; i < DATA_COUNT; i++) { |
| 36 |
output = clean_lower(data[i].filename); |
| 37 |
ck_assert_str_eq(output, data[i].expected); |
| 38 |
} |
| 39 |
|
| 40 |
#test test_clean_lower_null |
| 41 |
char *output; |
| 42 |
|
| 43 |
// confirm NULL works |
| 44 |
output = clean_lower(NULL); |
| 45 |
ck_assert(output == NULL); |