本網站在啟用 JavaScript 的情況下可以運作的更好。
首頁
探索
說明
登入
piumarta
/
ccmeta
關注
1
收藏
0
複製
0
程式碼
問題
0
合併請求
0
版本發佈
0
Wiki
活動
瀏覽代碼
new test files
master
Nathan R
3 年之前
父節點
8b54180b76
當前提交
24c4dbfde3
共有
220 個檔案被更改
,包括
6118 行新增
和
0 行删除
分割檢視
Diff Options
Show Stats
Download Patch File
Download Diff File
+5
-0
tests-c/00001.c
+5
-0
tests-c/00002.c
+8
-0
tests-c/00003.c
+12
-0
tests-c/00004.c
+23
-0
tests-c/00005.c
+10
-0
tests-c/00006.c
+15
-0
tests-c/00007.c
+11
-0
tests-c/00008.c
+11
-0
tests-c/00009.c
+13
-0
tests-c/00010.c
+8
-0
tests-c/00011.c
+5
-0
tests-c/00012.c
+10
-0
tests-c/00013.c
+11
-0
tests-c/00014.c
+10
-0
tests-c/00015.c
+10
-0
tests-c/00016.c
+9
-0
tests-c/00017.c
+13
-0
tests-c/00018.c
+10
-0
tests-c/00019.c
+10
-0
tests-c/00020.c
+12
-0
tests-c/00021.c
+10
-0
tests-c/00022.c
+9
-0
tests-c/00023.c
+12
-0
tests-c/00024.c
+10
-0
tests-c/00025.c
+8
-0
tests-c/00026.c
+10
-0
tests-c/00027.c
+10
-0
tests-c/00028.c
+10
-0
tests-c/00029.c
+24
-0
tests-c/00030.c
+48
-0
tests-c/00031.c
+30
-0
tests-c/00032.c
+45
-0
tests-c/00033.c
+32
-0
tests-c/00034.c
+15
-0
tests-c/00035.c
+19
-0
tests-c/00036.c
+17
-0
tests-c/00037.c
+17
-0
tests-c/00038.c
+13
-0
tests-c/00039.c
+55
-0
tests-c/00040.c
+26
-0
tests-c/00041.c
+11
-0
tests-c/00042.c
+19
-0
tests-c/00043.c
+16
-0
tests-c/00044.c
+16
-0
tests-c/00045.c
+33
-0
tests-c/00046.c
+14
-0
tests-c/00047.c
+12
-0
tests-c/00048.c
+14
-0
tests-c/00049.c
+33
-0
tests-c/00050.c
+38
-0
tests-c/00051.c
+10
-0
tests-c/00052.c
+13
-0
tests-c/00053.c
+22
-0
tests-c/00054.c
+22
-0
tests-c/00055.c
+18
-0
tests-c/00056.c
+9
-0
tests-c/00057.c
+15
-0
tests-c/00058.c
+8
-0
tests-c/00059.c
+11
-0
tests-c/00060.c
+7
-0
tests-c/00061.c
+25
-0
tests-c/00062.c
+20
-0
tests-c/00063.c
+7
-0
tests-c/00064.c
+8
-0
tests-c/00065.c
+11
-0
tests-c/00066.c
+18
-0
tests-c/00067.c
+13
-0
tests-c/00068.c
+13
-0
tests-c/00069.c
+15
-0
tests-c/00070.c
+12
-0
tests-c/00071.c
+14
-0
tests-c/00072.c
+14
-0
tests-c/00073.c
+32
-0
tests-c/00074.c
+166
-0
tests-c/00075.c
+9
-0
tests-c/00076.c
+48
-0
tests-c/00077.c
+17
-0
tests-c/00078.c
+17
-0
tests-c/00079.c
+12
-0
tests-c/00080.c
+11
-0
tests-c/00081.c
+11
-0
tests-c/00082.c
+47
-0
tests-c/00083.c
+54
-0
tests-c/00084.c
+26
-0
tests-c/00085.c
+11
-0
tests-c/00086.c
+20
-0
tests-c/00087.c
+11
-0
tests-c/00088.c
+30
-0
tests-c/00089.c
+14
-0
tests-c/00090.c
+19
-0
tests-c/00091.c
+19
-0
tests-c/00092.c
+10
-0
tests-c/00093.c
+6
-0
tests-c/00094.c
+22
-0
tests-c/00095.c
+12
-0
tests-c/00096.c
+14
-0
tests-c/00097.c
+5
-0
tests-c/00098.c
+13
-0
tests-c/00099.c
+11
-0
tests-c/00100.c
+ 5
- 0
tests-c/00001.c
查看文件
@ -0,0 +1,5 @@
int
main
(
)
{
return
0
;
}
+ 5
- 0
tests-c/00002.c
查看文件
@ -0,0 +1,5 @@
int
main
(
)
{
return
3
-
3
;
}
+ 8
- 0
tests-c/00003.c
查看文件
@ -0,0 +1,8 @@
int
main
(
)
{
int
x
;
x
=
4
;
return
x
-
4
;
}
+ 12
- 0
tests-c/00004.c
查看文件
@ -0,0 +1,12 @@
int
main
(
)
{
int
x
;
int
*
p
;
x
=
4
;
p
=
&
x
;
*
p
=
0
;
return
*
p
;
}
+ 23
- 0
tests-c/00005.c
查看文件
@ -0,0 +1,23 @@
int
main
(
)
{
int
x
;
int
*
p
;
int
*
*
pp
;
x
=
0
;
p
=
&
x
;
pp
=
&
p
;
if
(
*
p
)
return
1
;
if
(
*
*
pp
)
return
1
;
else
*
*
pp
=
1
;
if
(
x
)
return
0
;
else
return
1
;
}
+ 10
- 0
tests-c/00006.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
;
x
=
50
;
while
(
x
)
x
=
x
-
1
;
return
x
;
}
+ 15
- 0
tests-c/00007.c
查看文件
@ -0,0 +1,15 @@
int
main
(
)
{
int
x
;
x
=
1
;
for
(
x
=
10
;
x
;
x
=
x
-
1
)
;
if
(
x
)
return
1
;
x
=
10
;
for
(
;
x
;
)
x
=
x
-
1
;
return
x
;
}
+ 11
- 0
tests-c/00008.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
int
x
;
x
=
50
;
do
x
=
x
-
1
;
while
(
x
)
;
return
x
;
}
+ 11
- 0
tests-c/00009.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
int
x
;
x
=
1
;
x
=
x
*
10
;
x
=
x
/
2
;
x
=
x
%
3
;
return
x
-
2
;
}
+ 13
- 0
tests-c/00010.c
查看文件
@ -0,0 +1,13 @@
int
main
(
)
{
start
:
goto
next
;
return
1
;
success
:
return
0
;
next
:
foo
:
goto
success
;
return
1
;
}
+ 8
- 0
tests-c/00011.c
查看文件
@ -0,0 +1,8 @@
int
main
(
)
{
int
x
;
int
y
;
x
=
y
=
0
;
return
x
;
}
+ 5
- 0
tests-c/00012.c
查看文件
@ -0,0 +1,5 @@
int
main
(
)
{
return
(
2
+
2
)
*
2
-
8
;
}
+ 10
- 0
tests-c/00013.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
;
int
*
p
;
x
=
0
;
p
=
&
x
;
return
p
[
0
]
;
}
+ 11
- 0
tests-c/00014.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
int
x
;
int
*
p
;
x
=
1
;
p
=
&
x
;
p
[
0
]
=
0
;
return
x
;
}
+ 10
- 0
tests-c/00015.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
arr
[
2
]
;
arr
[
0
]
=
1
;
arr
[
1
]
=
2
;
return
arr
[
0
]
+
arr
[
1
]
-
3
;
}
+ 10
- 0
tests-c/00016.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
arr
[
2
]
;
int
*
p
;
p
=
&
arr
[
1
]
;
*
p
=
0
;
return
arr
[
1
]
;
}
+ 9
- 0
tests-c/00017.c
查看文件
@ -0,0 +1,9 @@
int
main
(
)
{
struct
{
int
x
;
int
y
;
}
s
;
s
.
x
=
3
;
s
.
y
=
5
;
return
s
.
y
-
s
.
x
-
2
;
}
+ 13
- 0
tests-c/00018.c
查看文件
@ -0,0 +1,13 @@
int
main
(
)
{
struct
S
{
int
x
;
int
y
;
}
s
;
struct
S
*
p
;
p
=
&
s
;
s
.
x
=
1
;
p
-
>
y
=
2
;
return
p
-
>
y
+
p
-
>
x
-
3
;
}
+ 10
- 0
tests-c/00019.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
struct
S
{
struct
S
*
p
;
int
x
;
}
s
;
s
.
x
=
0
;
s
.
p
=
&
s
;
return
s
.
p
-
>
p
-
>
p
-
>
p
-
>
p
-
>
x
;
}
+ 10
- 0
tests-c/00020.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
,
*
p
,
*
*
pp
;
x
=
0
;
p
=
&
x
;
pp
=
&
p
;
return
*
*
pp
;
}
+ 12
- 0
tests-c/00021.c
查看文件
@ -0,0 +1,12 @@
int
foo
(
int
a
,
int
b
)
{
return
2
+
a
-
b
;
}
int
main
(
)
{
return
foo
(
1
,
3
)
;
}
+ 10
- 0
tests-c/00022.c
查看文件
@ -0,0 +1,10 @@
typedef
int
x
;
int
main
(
)
{
x
v
;
v
=
0
;
return
v
;
}
+ 9
- 0
tests-c/00023.c
查看文件
@ -0,0 +1,9 @@
int
x
;
int
main
(
)
{
x
=
0
;
return
x
;
}
+ 12
- 0
tests-c/00024.c
查看文件
@ -0,0 +1,12 @@
typedef
struct
{
int
x
;
int
y
;
}
s
;
s
v
;
int
main
(
)
{
v
.
x
=
1
;
v
.
y
=
2
;
return
3
-
v
.
x
-
v
.
y
;
}
+ 10
- 0
tests-c/00025.c
查看文件
@ -0,0 +1,10 @@
int
strlen
(
char
*
)
;
int
main
(
)
{
char
*
p
;
p
=
"
hello
"
;
return
strlen
(
p
)
-
5
;
}
+ 8
- 0
tests-c/00026.c
查看文件
@ -0,0 +1,8 @@
int
main
(
)
{
char
*
p
;
p
=
"
hello
"
;
return
p
[
0
]
-
104
;
}
+ 10
- 0
tests-c/00027.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
;
x
=
1
;
x
=
x
|
4
;
return
x
-
5
;
}
+ 10
- 0
tests-c/00028.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
;
x
=
1
;
x
=
x
&
3
;
return
x
-
1
;
}
+ 10
- 0
tests-c/00029.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
int
x
;
x
=
1
;
x
=
x
^
3
;
return
x
-
2
;
}
+ 24
- 0
tests-c/00030.c
查看文件
@ -0,0 +1,24 @@
int
f
(
)
{
return
100
;
}
int
main
(
)
{
if
(
f
(
)
>
1000
)
return
1
;
if
(
f
(
)
>
=
1000
)
return
1
;
if
(
1000
<
f
(
)
)
return
1
;
if
(
1000
<
=
f
(
)
)
return
1
;
if
(
1000
=
=
f
(
)
)
return
1
;
if
(
100
!
=
f
(
)
)
return
1
;
return
0
;
}
+ 48
- 0
tests-c/00031.c
查看文件
@ -0,0 +1,48 @@
int
zero
(
)
{
return
0
;
}
int
one
(
)
{
return
1
;
}
int
main
(
)
{
int
x
;
int
y
;
x
=
zero
(
)
;
y
=
+
+
x
;
if
(
x
!
=
1
)
return
1
;
if
(
y
!
=
1
)
return
1
;
x
=
one
(
)
;
y
=
-
-
x
;
if
(
x
!
=
0
)
return
1
;
if
(
y
!
=
0
)
return
1
;
x
=
zero
(
)
;
y
=
x
+
+
;
if
(
x
!
=
1
)
return
1
;
if
(
y
!
=
0
)
return
1
;
x
=
one
(
)
;
y
=
x
-
-
;
if
(
x
!
=
0
)
return
1
;
if
(
y
!
=
1
)
return
1
;
return
0
;
}
+ 30
- 0
tests-c/00032.c
查看文件
@ -0,0 +1,30 @@
int
main
(
)
{
int
arr
[
2
]
;
int
*
p
;
arr
[
0
]
=
2
;
arr
[
1
]
=
3
;
p
=
&
arr
[
0
]
;
if
(
*
(
p
+
+
)
!
=
2
)
return
1
;
if
(
*
(
p
+
+
)
!
=
3
)
return
2
;
p
=
&
arr
[
1
]
;
if
(
*
(
p
-
-
)
!
=
3
)
return
1
;
if
(
*
(
p
-
-
)
!
=
2
)
return
2
;
p
=
&
arr
[
0
]
;
if
(
*
(
+
+
p
)
!
=
3
)
return
1
;
p
=
&
arr
[
1
]
;
if
(
*
(
-
-
p
)
!
=
2
)
return
1
;
return
0
;
}
+ 45
- 0
tests-c/00033.c
查看文件
@ -0,0 +1,45 @@
int
g
;
int
effect
(
)
{
g
=
1
;
return
1
;
}
int
main
(
)
{
int
x
;
g
=
0
;
x
=
0
;
if
(
x
&
&
effect
(
)
)
return
1
;
if
(
g
)
return
2
;
x
=
1
;
if
(
x
&
&
effect
(
)
)
{
if
(
g
!
=
1
)
return
3
;
}
else
{
return
4
;
}
g
=
0
;
x
=
1
;
if
(
x
|
|
effect
(
)
)
{
if
(
g
)
return
5
;
}
else
{
return
6
;
}
x
=
0
;
if
(
x
|
|
effect
(
)
)
{
if
(
g
!
=
1
)
return
7
;
}
else
{
return
8
;
}
return
0
;
}
+ 32
- 0
tests-c/00034.c
查看文件
@ -0,0 +1,32 @@
int
main
(
)
{
int
x
;
x
=
0
;
while
(
1
)
break
;
while
(
1
)
{
if
(
x
=
=
5
)
{
break
;
}
x
=
x
+
1
;
continue
;
}
for
(
;
;
)
{
if
(
x
=
=
10
)
{
break
;
}
x
=
x
+
1
;
continue
;
}
do
{
if
(
x
=
=
15
)
{
break
;
}
x
=
x
+
1
;
continue
;
}
while
(
1
)
;
return
x
-
15
;
}
+ 15
- 0
tests-c/00035.c
查看文件
@ -0,0 +1,15 @@
int
main
(
)
{
int
x
;
x
=
4
;
if
(
!
x
!
=
0
)
return
1
;
if
(
!
!
x
!
=
1
)
return
1
;
if
(
-
x
!
=
0
-
4
)
return
1
;
return
0
;
}
+ 19
- 0
tests-c/00036.c
查看文件
@ -0,0 +1,19 @@
int
main
(
)
{
int
x
;
x
=
0
;
x
+
=
2
;
x
+
=
2
;
if
(
x
!
=
4
)
return
1
;
x
-
=
1
;
if
(
x
!
=
3
)
return
2
;
x
*
=
2
;
if
(
x
!
=
6
)
return
3
;
return
0
;
}
+ 17
- 0
tests-c/00037.c
查看文件
@ -0,0 +1,17 @@
int
main
(
)
{
int
x
[
2
]
;
int
*
p
;
x
[
1
]
=
7
;
p
=
&
x
[
0
]
;
p
=
p
+
1
;
if
(
*
p
!
=
7
)
return
1
;
if
(
&
x
[
1
]
-
&
x
[
0
]
!
=
1
)
return
1
;
return
0
;
}
+ 17
- 0
tests-c/00038.c
查看文件
@ -0,0 +1,17 @@
int
main
(
)
{
int
x
,
*
p
;
if
(
sizeof
(
0
)
<
2
)
return
1
;
if
(
sizeof
0
<
2
)
return
1
;
if
(
sizeof
(
char
)
<
1
)
return
1
;
if
(
sizeof
(
int
)
-
2
<
0
)
return
1
;
if
(
sizeof
(
&
x
)
!
=
sizeof
p
)
return
1
;
return
0
;
}
+ 13
- 0
tests-c/00039.c
查看文件
@ -0,0 +1,13 @@
int
main
(
)
{
void
*
p
;
int
x
;
x
=
2
;
p
=
&
x
;
if
(
*
(
(
int
*
)
p
)
!
=
2
)
return
1
;
return
0
;
}
+ 55
- 0
tests-c/00040.c
查看文件
@ -0,0 +1,55 @@
#
include
<stdlib.h>
int
N
;
int
*
t
;
int
chk
(
int
x
,
int
y
)
{
int
i
;
int
r
;
for
(
r
=
i
=
0
;
i
<
8
;
i
+
+
)
{
r
=
r
+
t
[
x
+
8
*
i
]
;
r
=
r
+
t
[
i
+
8
*
y
]
;
if
(
x
+
i
<
8
&
y
+
i
<
8
)
r
=
r
+
t
[
x
+
i
+
8
*
(
y
+
i
)
]
;
if
(
x
+
i
<
8
&
y
-
i
>
=
0
)
r
=
r
+
t
[
x
+
i
+
8
*
(
y
-
i
)
]
;
if
(
x
-
i
>
=
0
&
y
+
i
<
8
)
r
=
r
+
t
[
x
-
i
+
8
*
(
y
+
i
)
]
;
if
(
x
-
i
>
=
0
&
y
-
i
>
=
0
)
r
=
r
+
t
[
x
-
i
+
8
*
(
y
-
i
)
]
;
}
return
r
;
}
int
go
(
int
n
,
int
x
,
int
y
)
{
if
(
n
=
=
8
)
{
N
+
+
;
return
0
;
}
for
(
;
y
<
8
;
y
+
+
)
{
for
(
;
x
<
8
;
x
+
+
)
if
(
chk
(
x
,
y
)
=
=
0
)
{
t
[
x
+
8
*
y
]
+
+
;
go
(
n
+
1
,
x
,
y
)
;
t
[
x
+
8
*
y
]
-
-
;
}
x
=
0
;
}
return
0
;
}
int
main
(
)
{
t
=
calloc
(
64
,
sizeof
(
int
)
)
;
go
(
0
,
0
,
0
)
;
if
(
N
!
=
92
)
return
1
;
return
0
;
}
+ 26
- 0
tests-c/00041.c
查看文件
@ -0,0 +1,26 @@
int
main
(
)
{
int
n
;
int
t
;
int
c
;
int
p
;
c
=
0
;
n
=
2
;
while
(
n
<
5000
)
{
t
=
2
;
p
=
1
;
while
(
t
*
t
<
=
n
)
{
if
(
n
%
t
=
=
0
)
p
=
0
;
t
+
+
;
}
n
+
+
;
if
(
p
)
c
+
+
;
}
if
(
c
!
=
669
)
return
1
;
return
0
;
}
+ 11
- 0
tests-c/00042.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
union
{
int
a
;
int
b
;
}
u
;
u
.
a
=
1
;
u
.
b
=
3
;
if
(
u
.
a
!
=
3
|
|
u
.
b
!
=
3
)
return
1
;
return
0
;
}
+ 19
- 0
tests-c/00043.c
查看文件
@ -0,0 +1,19 @@
struct
s
{
int
x
;
struct
{
int
y
;
int
z
;
}
nest
;
}
;
int
main
(
)
{
struct
s
v
;
v
.
x
=
1
;
v
.
nest
.
y
=
2
;
v
.
nest
.
z
=
3
;
if
(
v
.
x
+
v
.
nest
.
y
+
v
.
nest
.
z
!
=
6
)
return
1
;
return
0
;
}
+ 16
- 0
tests-c/00044.c
查看文件
@ -0,0 +1,16 @@
struct
T
;
struct
T
{
int
x
;
}
;
int
main
(
)
{
struct
T
v
;
{
struct
T
{
int
z
;
}
;
}
v
.
x
=
2
;
if
(
v
.
x
!
=
2
)
return
1
;
return
0
;
}
+ 16
- 0
tests-c/00045.c
查看文件
@ -0,0 +1,16 @@
int
x
=
5
;
long
y
=
6
;
int
*
p
=
&
x
;
int
main
(
)
{
if
(
x
!
=
5
)
return
1
;
if
(
y
!
=
6
)
return
2
;
if
(
*
p
!
=
5
)
return
3
;
return
0
;
}
+ 33
- 0
tests-c/00046.c
查看文件
@ -0,0 +1,33 @@
typedef
struct
{
int
a
;
union
{
int
b1
;
int
b2
;
}
;
struct
{
union
{
struct
{
int
c
;
}
;
}
;
}
;
struct
{
int
d
;
}
;
}
s
;
int
main
(
)
{
s
v
;
v
.
a
=
1
;
v
.
b1
=
2
;
v
.
c
=
3
;
v
.
d
=
4
;
if
(
v
.
a
!
=
1
)
return
1
;
if
(
v
.
b1
!
=
2
&
&
v
.
b2
!
=
2
)
return
2
;
if
(
v
.
c
!
=
3
)
return
3
;
if
(
v
.
d
!
=
4
)
return
4
;
return
0
;
}
+ 14
- 0
tests-c/00047.c
查看文件
@ -0,0 +1,14 @@
struct
{
int
a
;
int
b
;
int
c
;
}
s
=
{
1
,
2
,
3
}
;
int
main
(
)
{
if
(
s
.
a
!
=
1
)
return
1
;
if
(
s
.
b
!
=
2
)
return
2
;
if
(
s
.
c
!
=
3
)
return
3
;
return
0
;
}
+ 12
- 0
tests-c/00048.c
查看文件
@ -0,0 +1,12 @@
struct
S
{
int
a
;
int
b
;
}
;
struct
S
s
=
{
.
b
=
2
,
.
a
=
1
}
;
int
main
(
)
{
if
(
s
.
a
!
=
1
)
return
1
;
if
(
s
.
b
!
=
2
)
return
2
;
return
0
;
}
+ 14
- 0
tests-c/00049.c
查看文件
@ -0,0 +1,14 @@
int
x
=
10
;
struct
S
{
int
a
;
int
*
p
;
}
;
struct
S
s
=
{
.
p
=
&
x
,
.
a
=
1
}
;
int
main
(
)
{
if
(
s
.
a
!
=
1
)
return
1
;
if
(
*
s
.
p
!
=
10
)
return
2
;
return
0
;
}
+ 33
- 0
tests-c/00050.c
查看文件
@ -0,0 +1,33 @@
struct
S1
{
int
a
;
int
b
;
}
;
struct
S2
{
int
a
;
int
b
;
union
{
int
c
;
int
d
;
}
;
struct
S1
s
;
}
;
struct
S2
v
=
{
1
,
2
,
3
,
{
4
,
5
}
}
;
int
main
(
)
{
if
(
v
.
a
!
=
1
)
return
1
;
if
(
v
.
b
!
=
2
)
return
2
;
if
(
v
.
c
!
=
3
|
|
v
.
d
!
=
3
)
return
3
;
if
(
v
.
s
.
a
!
=
4
)
return
4
;
if
(
v
.
s
.
b
!
=
5
)
return
5
;
return
0
;
}
+ 38
- 0
tests-c/00051.c
查看文件
@ -0,0 +1,38 @@
int
x
=
0
;
int
main
(
)
{
switch
(
x
)
case
0
:
;
switch
(
x
)
case
0
:
switch
(
x
)
{
case
0
:
goto
next
;
default
:
return
1
;
}
return
1
;
next
:
switch
(
x
)
case
1
:
return
1
;
switch
(
x
)
{
{
x
=
1
+
1
;
foo
:
case
1
:
return
1
;
}
}
switch
(
x
)
{
case
0
:
return
x
;
case
1
:
return
1
;
default
:
return
1
;
}
}
+ 10
- 0
tests-c/00052.c
查看文件
@ -0,0 +1,10 @@
int
main
(
)
{
struct
T
{
int
x
;
}
;
{
struct
T
s
;
s
.
x
=
0
;
return
s
.
x
;
}
}
+ 13
- 0
tests-c/00053.c
查看文件
@ -0,0 +1,13 @@
int
main
(
)
{
struct
T
{
int
x
;
}
s1
;
s1
.
x
=
1
;
{
struct
T
{
int
y
;
}
s2
;
s2
.
y
=
1
;
if
(
s1
.
x
-
s2
.
y
!
=
0
)
return
1
;
}
return
0
;
}
+ 22
- 0
tests-c/00054.c
查看文件
@ -0,0 +1,22 @@
enum
E
{
x
,
y
,
z
,
}
;
int
main
(
)
{
enum
E
e
;
if
(
x
!
=
0
)
return
1
;
if
(
y
!
=
1
)
return
2
;
if
(
z
!
=
2
)
return
3
;
e
=
x
;
return
e
;
}
+ 22
- 0
tests-c/00055.c
查看文件
@ -0,0 +1,22 @@
enum
E
{
x
,
y
=
2
,
z
,
}
;
int
main
(
)
{
enum
E
e
;
if
(
x
!
=
0
)
return
1
;
if
(
y
!
=
2
)
return
2
;
if
(
z
!
=
3
)
return
3
;
e
=
x
;
return
e
;
}
+ 18
- 0
tests-c/00056.c
查看文件
@ -0,0 +1,18 @@
#
include
<stdio.h>
int
main
(
)
{
int
a
;
a
=
42
;
printf
(
"
%d
\n
"
,
a
)
;
int
b
=
64
;
printf
(
"
%d
\n
"
,
b
)
;
int
c
=
12
,
d
=
34
;
printf
(
"
%d, %d
\n
"
,
c
,
d
)
;
return
0
;
}
/
/
vim
:
set
expandtab
ts
=
4
sw
=
3
sts
=
3
tw
=
80
:
+ 9
- 0
tests-c/00057.c
查看文件
@ -0,0 +1,9 @@
int
main
(
)
{
char
a
[
16
]
,
b
[
16
]
;
if
(
sizeof
(
a
)
!
=
sizeof
(
b
)
)
return
1
;
return
0
;
}
+ 15
- 0
tests-c/00058.c
查看文件
@ -0,0 +1,15 @@
int
main
(
)
{
char
*
s
;
s
=
"
abc
"
"
def
"
;
if
(
s
[
0
]
!
=
'
a
'
)
return
1
;
if
(
s
[
1
]
!
=
'
b
'
)
return
2
;
if
(
s
[
2
]
!
=
'
c
'
)
return
3
;
if
(
s
[
3
]
!
=
'
d
'
)
return
4
;
if
(
s
[
4
]
!
=
'
e
'
)
return
5
;
if
(
s
[
5
]
!
=
'
f
'
)
return
6
;
if
(
s
[
6
]
!
=
0
)
return
7
;
return
0
;
}
+ 8
- 0
tests-c/00059.c
查看文件
@ -0,0 +1,8 @@
int
main
(
)
{
if
(
'
a
'
!
=
97
)
return
1
;
return
0
;
}
+ 11
- 0
tests-c/00060.c
查看文件
@ -0,0 +1,11 @@
/
/
line
comment
int
main
(
)
{
/*
multiline
comment
*/
return
0
;
}
+ 7
- 0
tests-c/00061.c
查看文件
@ -0,0 +1,7 @@
#
define FOO 0
int
main
(
)
{
return
FOO
;
}
+ 25
- 0
tests-c/00062.c
查看文件
@ -0,0 +1,25 @@
#
ifdef FOO
XXX
#
ifdef BAR
XXX
#
endif
XXX
#
endif
#
define FOO 1
#
ifdef FOO
#
ifdef FOO
int
x
=
0
;
#
endif
int
main
(
)
{
return
x
;
}
#
endif
+ 20
- 0
tests-c/00063.c
查看文件
@ -0,0 +1,20 @@
#
define BAR 0
#
ifdef BAR
#
ifdef FOO
XXX
#
ifdef FOO
XXX
#
endif
#
else
#
define FOO
#
ifdef FOO
int
x
=
BAR
;
#
endif
#
endif
#
endif
int
main
(
)
{
return
BAR
;
}
+ 7
- 0
tests-c/00064.c
查看文件
@ -0,0 +1,7 @@
#
define X 6
/
2
int
main
(
)
{
return
X
-
3
;
}
+ 8
- 0
tests-c/00065.c
查看文件
@ -0,0 +1,8 @@
#
define ADD(X, Y) (X + Y)
int
main
(
)
{
return
ADD
(
1
,
2
)
-
3
;
}
+ 11
- 0
tests-c/00066.c
查看文件
@ -0,0 +1,11 @@
#
define A 3
#
define FOO(X,Y,Z) X + Y + Z
#
define SEMI ;
int
main
(
)
{
if
(
FOO
(
1
,
2
,
A
)
!
=
6
)
return
1
SEMI
return
FOO
(
0
,
0
,
0
)
;
}
+ 18
- 0
tests-c/00067.c
查看文件
@ -0,0 +1,18 @@
#
if 1
int
x
=
0
;
#
endif
#if 0
int
x
=
1
;
#
if 1
X
#
endif
#
ifndef AAA
X
#
endif
#
endif
int
main
(
)
{
return
x
;
}
+ 13
- 0
tests-c/00068.c
查看文件
@ -0,0 +1,13 @@
#if 0
X
#
elif 1
int
x
=
0
;
#
else
X
#
endif
int
main
(
)
{
return
x
;
}
+ 13
- 0
tests-c/00069.c
查看文件
@ -0,0 +1,13 @@
#if 0
X
#
elif 0
X
#
elif 1
int
x
=
0
;
#
endif
int
main
(
)
{
return
x
;
}
+ 15
- 0
tests-c/00070.c
查看文件
@ -0,0 +1,15 @@
#
ifndef DEF
int
x
=
0
;
#
endif
#
define DEF
#
ifndef DEF
X
#
endif
int
main
(
)
{
return
x
;
}
+ 12
- 0
tests-c/00071.c
查看文件
@ -0,0 +1,12 @@
#
define X 1
#
undef X
#
ifdef X
FAIL
#
endif
int
main
(
)
{
return
0
;
}
+ 14
- 0
tests-c/00072.c
查看文件
@ -0,0 +1,14 @@
int
main
(
)
{
int
arr
[
2
]
;
int
*
p
;
p
=
&
arr
[
0
]
;
p
+
=
1
;
*
p
=
123
;
if
(
arr
[
1
]
!
=
123
)
return
1
;
return
0
;
}
+ 14
- 0
tests-c/00073.c
查看文件
@ -0,0 +1,14 @@
int
main
(
)
{
int
arr
[
2
]
;
int
*
p
;
p
=
&
arr
[
1
]
;
p
-
=
1
;
*
p
=
123
;
if
(
arr
[
0
]
!
=
123
)
return
1
;
return
0
;
}
+ 32
- 0
tests-c/00074.c
查看文件
@ -0,0 +1,32 @@
#
if defined X
X
#
endif
#
if defined(X)
X
#
endif
#
if X
X
#
endif
#
define X 0
#
if X
X
#
endif
#
if defined(X)
int
x
=
0
;
#
endif
#
undef X
#
define X 1
#
if X
int
main
(
)
{
return
0
;
}
#
endif
+ 166
- 0
tests-c/00075.c
查看文件
@ -0,0 +1,166 @@
#
if (-2) != -2
#
error fail
#
endif
#
if (0 || 0) != 0
#
error fail
#
endif
#
if (1 || 0) != 1
#
error fail
#
endif
#
if (1 || 1) != 1
#
error fail
#
endif
#
if (0 && 0) != 0
#
error fail
#
endif
#
if (1 && 0) != 0
#
error fail
#
endif
#
if (0 && 1) != 0
#
error fail
#
endif
#
if (1 && 1) != 1
#
error fail
#
endif
#
if (0xf0 | 1) != 0xf1
#
error fail
#
endif
#
if (0xf0 & 1) != 0
#
error fail
#
endif
#
if (0xf0 & 0x1f) != 0x10
#
error fail
#
endif
#
if (1 ^ 1) != 0
#
error fail
#
endif
#
if (1 == 1) != 1
#
error fail
#
endif
#
if (1 == 0) != 0
#
error fail
#
endif
#
if (1 != 1) != 0
#
error fail
#
endif
#
if (0 != 1) != 1
#
error fail
#
endif
#
if (0 > 1) != 0
#
error fail
#
endif
#
if (0 < 1) != 1
#
error fail
#
endif
#
if (0 > -1) != 1
#
error fail
#
endif
#
if (0 < -1) != 0
#
error fail
#
endif
#
if (0 >= 1) != 0
#
error fail
#
endif
#
if (0 <= 1) != 1
#
error fail
#
endif
#
if (0 >= -1) != 1
#
error fail
#
endif
#
if (0 <= -1) != 0
#
error fail
#
endif
#
if (0 < 0) != 0
#
error fail
#
endif
#
if (0 <= 0) != 1
#
error fail
#
endif
#
if (0 > 0) != 0
#
error fail
#
endif
#
if (0 >= 0) != 1
#
error fail
#
endif
#
if (1 << 1) != 2
#
error fail
#
endif
#
if (2 >> 1) != 1
#
error fail
#
endif
#
if (2 + 1) != 3
#
error fail
#
endif
#
if (2 - 3) != -1
#
error fail
#
endif
#
if (2 * 3) != 6
#
error fail
#
endif
#
if (6
/
3) != 2
#
error fail
#
endif
#
if (7 % 3) != 1
#
error fail
#
endif
#
if (2+2*3+2) != 10
#
error fail
#
endif
#
if ((2+2)*(3+2)) != 20
#
error fail
#
endif
#
if (2 + 2 + 2 + 2 == 2 + 2 * 3) != 1
#
error fail
#
endif
#
if (0 ? 1 : 3) != 3
#
error fail
#
endif
#
if (1 ? 3 : 1) != 3
#
error fail
#
endif
int
main
(
)
{
return
0
;
}
+ 9
- 0
tests-c/00076.c
查看文件
@ -0,0 +1,9 @@
int
main
(
)
{
if
(
0
?
1
:
0
)
return
1
;
if
(
1
?
0
:
1
)
return
2
;
return
0
;
}
+ 48
- 0
tests-c/00077.c
查看文件
@ -0,0 +1,48 @@
int
foo
(
int
x
[
100
]
)
{
int
y
[
100
]
;
int
*
p
;
y
[
0
]
=
2000
;
if
(
x
[
0
]
!
=
1000
)
{
return
1
;
}
p
=
x
;
if
(
p
[
0
]
!
=
1000
)
{
return
2
;
}
p
=
y
;
if
(
p
[
0
]
!
=
2000
)
{
return
3
;
}
if
(
sizeof
(
x
)
!
=
sizeof
(
void
*
)
)
{
return
4
;
}
if
(
sizeof
(
y
)
<
=
sizeof
(
x
)
)
{
return
5
;
}
return
0
;
}
int
main
(
)
{
int
x
[
100
]
;
x
[
0
]
=
1000
;
return
foo
(
x
)
;
}
+ 17
- 0
tests-c/00078.c
查看文件
@ -0,0 +1,17 @@
int
f1
(
char
*
p
)
{
return
*
p
+
1
;
}
int
main
(
)
{
char
s
=
1
;
int
v
[
1000
]
;
int
f1
(
char
*
)
;
if
(
f1
(
&
s
)
!
=
2
)
return
1
;
return
0
;
}
+ 17
- 0
tests-c/00079.c
查看文件
@ -0,0 +1,17 @@
#
define x(y) ((y) + 1)
int
main
(
)
{
int
x
;
int
y
;
y
=
0
;
x
=
x
(
y
)
;
if
(
x
!
=
1
)
return
1
;
return
0
;
}
+ 12
- 0
tests-c/00080.c
查看文件
@ -0,0 +1,12 @@
void
voidfn
(
)
{
return
;
}
int
main
(
)
{
voidfn
(
)
;
return
0
;
}
+ 11
- 0
tests-c/00081.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
long
long
x
;
x
=
0
;
x
=
x
+
1
;
if
(
x
!
=
1
)
return
1
;
return
0
;
}
+ 11
- 0
tests-c/00082.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
unsigned
long
long
x
;
x
=
0
;
x
=
x
+
1
;
if
(
x
!
=
1
)
return
1
;
return
0
;
}
+ 47
- 0
tests-c/00083.c
查看文件
@ -0,0 +1,47 @@
#
define CALL(FUN, ...) FUN(__VA_ARGS__)
int
one
(
int
a
)
{
if
(
a
!
=
1
)
return
1
;
return
0
;
}
int
two
(
int
a
,
int
b
)
{
if
(
a
!
=
1
)
return
1
;
if
(
b
!
=
2
)
return
1
;
return
0
;
}
int
three
(
int
a
,
int
b
,
int
c
)
{
if
(
a
!
=
1
)
return
1
;
if
(
b
!
=
2
)
return
1
;
if
(
c
!
=
3
)
return
1
;
return
0
;
}
int
main
(
)
{
if
(
CALL
(
one
,
1
)
)
return
2
;
if
(
CALL
(
two
,
1
,
2
)
)
return
3
;
if
(
CALL
(
three
,
1
,
2
,
3
)
)
return
4
;
return
0
;
}
+ 54
- 0
tests-c/00084.c
查看文件
@ -0,0 +1,54 @@
#
define ARGS(...) __VA_ARGS__
int
none
(
)
{
return
0
;
}
int
one
(
int
a
)
{
if
(
a
!
=
1
)
return
1
;
return
0
;
}
int
two
(
int
a
,
int
b
)
{
if
(
a
!
=
1
)
return
1
;
if
(
b
!
=
2
)
return
1
;
return
0
;
}
int
three
(
int
a
,
int
b
,
int
c
)
{
if
(
a
!
=
1
)
return
1
;
if
(
b
!
=
2
)
return
1
;
if
(
c
!
=
3
)
return
1
;
return
0
;
}
int
main
(
)
{
if
(
none
(
ARGS
(
)
)
)
return
1
;
if
(
one
(
ARGS
(
1
)
)
)
return
2
;
if
(
two
(
ARGS
(
1
,
2
)
)
)
return
3
;
if
(
three
(
ARGS
(
1
,
2
,
3
)
)
)
return
4
;
return
0
;
}
+ 26
- 0
tests-c/00085.c
查看文件
@ -0,0 +1,26 @@
#
define ZERO_0() 0
#
define ZERO_1(A) 0
#
define ZERO_2(A, B) 0
#
define ZERO_VAR(...) 0
#
define ZERO_1_VAR(A, ...) 0
int
main
(
)
{
if
(
ZERO_0
(
)
)
return
1
;
if
(
ZERO_1
(
1
)
)
return
1
;
if
(
ZERO_2
(
1
,
2
)
)
return
1
;
if
(
ZERO_VAR
(
1
)
)
return
1
;
if
(
ZERO_VAR
(
1
,
2
)
)
return
1
;
if
(
ZERO_1_VAR
(
1
,
2
)
)
return
1
;
if
(
ZERO_1_VAR
(
1
,
2
,
3
)
)
return
1
;
return
0
;
}
+ 11
- 0
tests-c/00086.c
查看文件
@ -0,0 +1,11 @@
int
main
(
)
{
short
x
;
x
=
0
;
x
=
x
+
1
;
if
(
x
!
=
1
)
return
1
;
return
0
;
}
+ 20
- 0
tests-c/00087.c
查看文件
@ -0,0 +1,20 @@
struct
S
{
int
(
*
fptr
)
(
)
;
}
;
int
foo
(
)
{
return
0
;
}
int
main
(
)
{
struct
S
v
;
v
.
fptr
=
foo
;
return
v
.
fptr
(
)
;
}
+ 11
- 0
tests-c/00088.c
查看文件
@ -0,0 +1,11 @@
int
(
*
fptr
)
(
)
=
0
;
int
main
(
)
{
if
(
fptr
)
return
1
;
return
0
;
}
+ 30
- 0
tests-c/00089.c
查看文件
@ -0,0 +1,30 @@
int
zero
(
)
{
return
0
;
}
struct
S
{
int
(
*
zerofunc
)
(
)
;
}
s
=
{
&
zero
}
;
struct
S
*
anon
(
)
{
return
&
s
;
}
typedef
struct
S
*
(
*
fty
)
(
)
;
fty
go
(
)
{
return
&
anon
;
}
int
main
(
)
{
return
go
(
)
(
)
-
>
zerofunc
(
)
;
}
+ 14
- 0
tests-c/00090.c
查看文件
@ -0,0 +1,14 @@
int
a
[
3
]
=
{
0
,
1
,
2
}
;
int
main
(
)
{
if
(
a
[
0
]
!
=
0
)
return
1
;
if
(
a
[
1
]
!
=
1
)
return
2
;
if
(
a
[
2
]
!
=
2
)
return
3
;
return
0
;
}
+ 19
- 0
tests-c/00091.c
查看文件
@ -0,0 +1,19 @@
typedef
struct
{
int
v
;
int
sub
[
2
]
;
}
S
;
S
a
[
1
]
=
{
{
1
,
{
2
,
3
}
}
}
;
int
main
(
)
{
if
(
a
[
0
]
.
v
!
=
1
)
return
1
;
if
(
a
[
0
]
.
sub
[
0
]
!
=
2
)
return
2
;
if
(
a
[
0
]
.
sub
[
1
]
!
=
3
)
return
3
;
return
0
;
}
+ 19
- 0
tests-c/00092.c
查看文件
@ -0,0 +1,19 @@
int
a
[
]
=
{
5
,
[
2
]
=
2
,
3
}
;
int
main
(
)
{
if
(
sizeof
(
a
)
!
=
4
*
sizeof
(
int
)
)
return
1
;
if
(
a
[
0
]
!
=
5
)
return
2
;
if
(
a
[
1
]
!
=
0
)
return
3
;
if
(
a
[
2
]
!
=
2
)
return
4
;
if
(
a
[
3
]
!
=
3
)
return
5
;
return
0
;
}
+ 10
- 0
tests-c/00093.c
查看文件
@ -0,0 +1,10 @@
int
a
[
]
=
{
1
,
2
,
3
,
4
}
;
int
main
(
)
{
if
(
sizeof
(
a
)
!
=
4
*
sizeof
(
int
)
)
return
1
;
return
0
;
}
+ 6
- 0
tests-c/00094.c
查看文件
@ -0,0 +1,6 @@
extern
int
x
;
int
main
(
)
{
return
0
;
}
+ 22
- 0
tests-c/00095.c
查看文件
@ -0,0 +1,22 @@
int
x
;
int
x
=
3
;
int
x
;
int
main
(
)
;
void
*
foo
(
)
{
return
&
main
;
}
int
main
(
)
{
if
(
x
!
=
3
)
return
0
;
x
=
0
;
return
x
;
}
+ 12
- 0
tests-c/00096.c
查看文件
@ -0,0 +1,12 @@
int
x
,
x
=
3
,
x
;
int
main
(
)
{
if
(
x
!
=
3
)
return
0
;
x
=
0
;
return
x
;
}
+ 14
- 0
tests-c/00097.c
查看文件
@ -0,0 +1,14 @@
#
define NULL ((void*)0)
#
define NULL ((void*)0)
#
define FOO(X, Y) (X + Y + Z)
#
define FOO(X, Y) (X + Y + Z)
#
define BAR(X, Y, ...) (X + Y + Z)
#
define BAR(X, Y, ...) (X + Y + Z)
int
main
(
)
{
return
0
;
}
+ 5
- 0
tests-c/00098.c
查看文件
@ -0,0 +1,5 @@
int
main
(
)
{
return
L
'
\0
'
;
}
+ 13
- 0
tests-c/00099.c
查看文件
@ -0,0 +1,13 @@
typedef
struct
{
int
n
;
}
Vec
;
static
void
vecresize
(
Vec
*
v
,
int
cap
)
{
return
;
}
int
main
(
)
{
return
0
;
}
+ 11
- 0
tests-c/00100.c
查看文件
@ -0,0 +1,11 @@
int
foo
(
void
)
{
return
0
;
}
int
main
(
)
{
return
foo
(
)
;
}
部分文件因文件數量過多而無法顯示
Write
Preview
Loading…
取消
儲存