Skip to content

Commit 64f8676

Browse files
committed
Remove DOS-style newlines from four tests
1 parent eb30caf commit 64f8676

File tree

4 files changed

+201
-203
lines changed

4 files changed

+201
-203
lines changed

tests/test74.c

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
#include <stdio.h> /* printf */
2-
#include "utstring.h"
3-
4-
int main()
5-
{
6-
UT_string *s,*t;
7-
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8-
char V_NeedleStr[] = "needle\0s";
9-
long V_FindPos;
10-
size_t V_FindCnt;
11-
12-
13-
utstring_new(s);
14-
utstring_new(t);
15-
16-
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
17-
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
18-
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
19-
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
20-
21-
V_FindCnt = 0;
22-
V_FindPos = 0;
23-
do {
24-
V_FindPos = utstring_find(s,
25-
V_FindPos,
26-
utstring_body(t),
27-
utstring_len(t));
28-
printf("utstring_find()=%ld\n", V_FindPos);
29-
if (V_FindPos >= 0) {
30-
V_FindPos++;
31-
V_FindCnt++;
32-
}
33-
} while (V_FindPos >= 0);
34-
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
35-
36-
utstring_free(s);
37-
utstring_free(t);
38-
39-
return 0;
40-
}
1+
#include <stdio.h> /* printf */
2+
#include "utstring.h"
3+
4+
int main()
5+
{
6+
UT_string *s,*t;
7+
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8+
char V_NeedleStr[] = "needle\0s";
9+
long V_FindPos;
10+
size_t V_FindCnt;
11+
12+
13+
utstring_new(s);
14+
utstring_new(t);
15+
16+
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
17+
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
18+
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
19+
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
20+
21+
V_FindCnt = 0;
22+
V_FindPos = 0;
23+
do {
24+
V_FindPos = utstring_find(s,
25+
V_FindPos,
26+
utstring_body(t),
27+
utstring_len(t));
28+
printf("utstring_find()=%ld\n", V_FindPos);
29+
if (V_FindPos >= 0) {
30+
V_FindPos++;
31+
V_FindCnt++;
32+
}
33+
} while (V_FindPos >= 0);
34+
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
35+
36+
utstring_free(s);
37+
utstring_free(t);
38+
39+
return 0;
40+
}

tests/test75.c

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
#include <stdio.h> /* printf */
2-
#include "utstring.h"
3-
4-
int main()
5-
{
6-
UT_string *s,*t;
7-
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8-
char V_NeedleStr[] = "needle\0s";
9-
long V_FindPos;
10-
size_t V_FindCnt;
11-
12-
13-
utstring_new(s);
14-
utstring_new(t);
15-
16-
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
17-
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
18-
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
19-
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
20-
21-
V_FindCnt = 0;
22-
V_FindPos = -1;
23-
do {
24-
V_FindPos = utstring_findR(s,
25-
V_FindPos,
26-
utstring_body(t),
27-
utstring_len(t));
28-
printf("utstring_findR()=%ld\n", V_FindPos);
29-
if (V_FindPos >= 0) {
30-
V_FindPos--;
31-
V_FindCnt++;
32-
}
33-
} while (V_FindPos >= 0);
34-
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
35-
36-
utstring_free(s);
37-
utstring_free(t);
38-
39-
return 0;
40-
}
1+
#include <stdio.h> /* printf */
2+
#include "utstring.h"
3+
4+
int main()
5+
{
6+
UT_string *s,*t;
7+
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8+
char V_NeedleStr[] = "needle\0s";
9+
long V_FindPos;
10+
size_t V_FindCnt;
11+
12+
13+
utstring_new(s);
14+
utstring_new(t);
15+
16+
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
17+
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
18+
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
19+
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
20+
21+
V_FindCnt = 0;
22+
V_FindPos = -1;
23+
do {
24+
V_FindPos = utstring_findR(s,
25+
V_FindPos,
26+
utstring_body(t),
27+
utstring_len(t));
28+
printf("utstring_findR()=%ld\n", V_FindPos);
29+
if (V_FindPos >= 0) {
30+
V_FindPos--;
31+
V_FindCnt++;
32+
}
33+
} while (V_FindPos >= 0);
34+
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
35+
36+
utstring_free(s);
37+
utstring_free(t);
38+
39+
return 0;
40+
}

tests/test76.c

+51-51
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
#include <stdio.h> /* printf */
2-
#include "utstring.h"
3-
4-
int main()
5-
{
6-
UT_string *s,*t;
7-
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8-
char V_NeedleStr[] = "needle\0s";
9-
long *V_KMP_Table;
10-
long V_FindPos;
11-
size_t V_StartPos = 0;
12-
size_t V_FindCnt = 0;
13-
14-
15-
utstring_new(s);
16-
utstring_new(t);
17-
18-
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
19-
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
20-
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
21-
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
22-
23-
V_KMP_Table = (long *)malloc(sizeof(long) * (utstring_len(t) + 1));
24-
if (V_KMP_Table != NULL) {
25-
_utstring_BuildTable(utstring_body(t), utstring_len(t), V_KMP_Table);
26-
27-
do {
28-
V_FindPos = _utstring_find(utstring_body(s) + V_StartPos,
29-
utstring_len(s) - V_StartPos,
30-
utstring_body(t),
31-
utstring_len(t),
32-
V_KMP_Table);
33-
if (V_FindPos >= 0) {
34-
V_FindPos += V_StartPos;
35-
V_FindCnt++;
36-
V_StartPos = V_FindPos + 1;
37-
}
38-
printf("utstring_find()=%ld\n", V_FindPos);
39-
} while (V_FindPos >= 0);
40-
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
41-
42-
free(V_KMP_Table);
43-
} else {
44-
printf("malloc() failed...\n");
45-
}
46-
47-
utstring_free(s);
48-
utstring_free(t);
49-
50-
return 0;
51-
}
1+
#include <stdio.h> /* printf */
2+
#include "utstring.h"
3+
4+
int main()
5+
{
6+
UT_string *s,*t;
7+
char V_TestStr[] = "There are two needle\0s in this \0haystack with needle\0s.";
8+
char V_NeedleStr[] = "needle\0s";
9+
long *V_KMP_Table;
10+
long V_FindPos;
11+
size_t V_StartPos = 0;
12+
size_t V_FindCnt = 0;
13+
14+
15+
utstring_new(s);
16+
utstring_new(t);
17+
18+
utstring_bincpy(s, V_TestStr, sizeof(V_TestStr)-1);
19+
printf("\"%s\" len=%u\n", utstring_body(s), (unsigned)utstring_len(s));
20+
utstring_bincpy(t, V_NeedleStr, sizeof(V_NeedleStr)-1);
21+
printf("\"%s\" len=%u\n", utstring_body(t), (unsigned)utstring_len(t));
22+
23+
V_KMP_Table = (long *)malloc(sizeof(long) * (utstring_len(t) + 1));
24+
if (V_KMP_Table != NULL) {
25+
_utstring_BuildTable(utstring_body(t), utstring_len(t), V_KMP_Table);
26+
27+
do {
28+
V_FindPos = _utstring_find(utstring_body(s) + V_StartPos,
29+
utstring_len(s) - V_StartPos,
30+
utstring_body(t),
31+
utstring_len(t),
32+
V_KMP_Table);
33+
if (V_FindPos >= 0) {
34+
V_FindPos += V_StartPos;
35+
V_FindCnt++;
36+
V_StartPos = V_FindPos + 1;
37+
}
38+
printf("utstring_find()=%ld\n", V_FindPos);
39+
} while (V_FindPos >= 0);
40+
printf("FindCnt=%u\n", (unsigned)V_FindCnt);
41+
42+
free(V_KMP_Table);
43+
} else {
44+
printf("malloc() failed...\n");
45+
}
46+
47+
utstring_free(s);
48+
utstring_free(t);
49+
50+
return 0;
51+
}

0 commit comments

Comments
 (0)