Skip to content

Commit 29f6e65

Browse files
committed
Add some test-related files.
1 parent f91f418 commit 29f6e65

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/double_width.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Always double width:
2+
汉字
3+
4+
Ambiguous width:
5+
αα

tests/spam.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
void setline(char* s, int n) {
4+
int l = random() % n;
5+
int j;
6+
for (j = 0; j < l; ++j) {
7+
s[j] = 'A' + (random() % 60);
8+
}
9+
s[j] = 0;
10+
}
11+
12+
int main(int argc, char*argv[]) {
13+
int n;
14+
if (argc == 1) {
15+
n = 1000000;
16+
} else {
17+
n = atoi(argv[1]);
18+
}
19+
for (int i = 0; i < n; ++i) {
20+
char buffer[100];
21+
setline(buffer, sizeof(buffer)-1);
22+
printf("%s\n", buffer);
23+
}
24+
return 0;
25+
}
26+

0 commit comments

Comments
 (0)