source: MondoRescue/branches/3.2/mondo/test/test-mr_strip_spaces.c@ 3616

Last change on this file since 3616 was 3616, checked in by Bruno Cornec, 7 years ago

Add forgotten test file for strip_spaces

  • Property svn:eol-style set to native
File size: 866 bytes
Line 
1/*
2 * $Id$
3 *
4 * Test program for mr_str_substitute
5 * Can be used on host system with valgrind easier than with mondorestore
6 */
7#include <stdio.h>
8#include <stdlib.h>
9#include "mr_str.h"
10#include "mr_mem.h"
11#include "my-stuff.h"
12
13/* Whether we should fail immediately at first error */
14bool g_fail_immediately = FALSE;
15
16void (*mr_cleanup)(void) = NULL;
17
18char *strl[] = {
19 " test with \n",
20 " \ttest\twith\tCDROM\t",
21 NULL
22};
23
24char *strlsub[] = {
25 "test with",
26 "test\twith\tCDROM",
27 NULL
28};
29
30int main() {
31
32 int i;
33 char *p;
34
35 for (i = 0; strl[i] != NULL ; i++) {
36 printf("Test %2d Original chain is ***%s***\n",i,strl[i]);
37 p = mr_strip_spaces(strl[i]);
38 printf("Test %2d Transformed chain (stripped) is ***%s***\n",i,p);
39 if (strcmp(p,strlsub[i]) != 0) {
40 printf("Error for mr_strip_spaces for ***%s***\n",strl[i]);
41 }
42 }
43exit(0);
44}
Note: See TracBrowser for help on using the repository browser.