Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
test-vscode-c-win
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸大学计算机学院
教师群组
赵鹏翀-zpc
test-vscode-c-win
提交
d1b7de83
提交
d1b7de83
3月 31, 2021
创建
作者:
赵鹏翀
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交作业
上级
9a40964b
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
18 行删除
+20
-18
tasks.json
.vscode/tasks.json
+4
-4
test.py
.vscode/test.py
+7
-14
fun.c
fun.c
+5
-0
main.c
main.c
+2
-0
makefile
makefile
+2
-0
没有找到文件。
.vscode/tasks.json
浏览文件 @
d1b7de83
...
...
@@ -5,10 +5,10 @@
"label"
:
"生成项目(make)"
,
"type"
:
"shell"
,
"windows"
:
{
"command"
:
"cat
\"
${execPath}.tips
\\
env_tip.txt
\"
; echo VSCode安装路径-${execPath} ; echo 正在生成项目 ; make"
"command"
:
"cat
\"
${execPath}.tips
\\
env_tip.txt
\"
; echo VSCode安装路径-${execPath} ; echo 正在
使用makefile文件
生成项目 ; make"
},
"linux"
:
{
"command"
:
"echo 正在生成项目 && make && echo 生成项目成功"
"command"
:
"echo 正在
使用makefile文件
生成项目 && make && echo 生成项目成功"
},
"args"
:
[],
"group"
:
"build"
,
...
...
@@ -57,10 +57,10 @@
"label"
:
"清理项目(make clean)"
,
"type"
:
"shell"
,
"windows"
:
{
"command"
:
"cat
\"
${execPath}.tips
\\
env_tip.txt
\"
; echo VSCode安装路径-${execPath} ; echo 正在清理项目 ; make clean"
"command"
:
"cat
\"
${execPath}.tips
\\
env_tip.txt
\"
; echo VSCode安装路径-${execPath} ; echo 正在
使用makefile文件
清理项目 ; make clean"
},
"linux"
:
{
"command"
:
"echo 正在清理项目 && make clean && echo 清理项目成功"
"command"
:
"echo 正在
使用makefile文件
清理项目 && make clean && echo 清理项目成功"
},
"args"
:
[],
"group"
:
"build"
,
...
...
.vscode/test.py
浏览文件 @
d1b7de83
...
...
@@ -88,7 +88,7 @@ def compare_file(file1, file2, seqNum, caseCount, bIncludeCi):
print
(
'文件路径不能为空:第一个文件的路径:{0}, 第二个文件的路径:{1} .'
.
format
(
file1
,
file2
))
sys
.
exit
()
else
:
print
(
"正在比较
文件 {0} 和
{1}"
.
format
(
file1
,
file2
),
end
=
': '
)
print
(
"正在比较
标准答案输出文件 {0} 和用户编写的应用程序输出文件
{1}"
.
format
(
file1
,
file2
),
end
=
': '
)
if
os
.
path
.
isfile
(
file1
)
and
os
.
path
.
isfile
(
file2
)
and
advanced_file_compare
(
file1
,
file2
):
print
(
"文件相同"
)
...
...
@@ -107,7 +107,8 @@ def compare_file(file1, file2, seqNum, caseCount, bIncludeCi):
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
if
seqNum
==
caseCount
:
print
(
"恭喜你,通过了所有的测试!"
)
promptInfo
=
"恭喜你通过了所有测试!"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
returnVal
=
1
return
returnVal
...
...
@@ -163,22 +164,17 @@ def outputPromptInfo(bIncludeCi, promptInfo, color):
if
__name__
==
"__main__"
:
if
bIncludeCi
==
False
:
print
(
"开发环境中的 Python 解释器版本号:"
+
platform
.
python_version
())
print
()
compResultFile
=
"result_comparation.html"
if
os
.
path
.
isfile
(
compResultFile
):
os
.
remove
(
compResultFile
)
promptInfo
=
"正在使用
make
生成项目"
promptInfo
=
"正在使用
makefile 文件
生成项目"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
execResult
=
os
.
system
(
"make"
)
if
execResult
!=
0
:
errorInfo
=
"
应用程序异常,返回值:{0}。"
.
format
(
execResult
)
errorInfo
=
"
生成项目失败"
outputPromptInfo
(
bIncludeCi
,
errorInfo
,
2
)
exit
(
1
)
else
:
...
...
@@ -186,12 +182,12 @@ if __name__ == "__main__":
if
not
os
.
path
.
isfile
(
"output1.txt"
):
score
=
100
if
bIncludeCi
:
promptInfo
=
"
项目生成
成功"
promptInfo
=
"
生成项目
成功"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
promptInfo
=
"exec-score {0}"
.
format
(
score
)
print
(
promptInfo
)
else
:
promptInfo
=
"
项目生成
成功, 分数 {0}"
.
format
(
score
)
promptInfo
=
"
生成项目
成功, 分数 {0}"
.
format
(
score
)
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
1
)
...
...
@@ -245,9 +241,6 @@ if __name__ == "__main__":
print
(
"使用的标准输入文件是 intput{0}.txt。
\n
标准答案输出文件 output{1}.txt(左边)与用户编写的应用程序输出文件 user_output{2}.txt(右边)的比较结果:"
.
format
(
seqNum
,
seqNum
,
seqNum
))
runCommand
=
"diff {0} {1} -b -B -y -i -W 100"
.
format
(
outputFile
,
useroutputFile
)
execResult
=
os
.
system
(
runCommand
)
#if execResult != 0:
# errorInfo = "输出结果比较异常,返回值:{0}。".format(execResult)
# outputPromptInfo(bIncludeCi, errorInfo, 2)
else
:
promptInfo
=
"查看文件比较结果可帮助你查找验证失败的原因。方法是:
\n
选择 View 菜单中的 Explorer 打开文件列表,右键点击 result_comparation.html 文件,在弹出的菜单中选择 Open Preview"
outputPromptInfo
(
bIncludeCi
,
promptInfo
,
2
)
...
...
fun.c
0 → 100644
浏览文件 @
d1b7de83
void
fun
()
{
int
a
,
b
;
b
=
a
;
}
main.c
浏览文件 @
d1b7de83
#include <stdio.h>
#include <stdlib.h>
void
fun
();
int
main
()
{
int
x
,
y
;
int
*
p
=
malloc
(
8
);
fun
();
scanf
(
"%d"
,
&
x
);
...
...
makefile
浏览文件 @
d1b7de83
...
...
@@ -16,9 +16,11 @@ CC = gcc
CFLAGS
=
-g
-w
-fmax-errors
=
10
-std
=
c99
-fsigned-char
-I
${
DIR_INC
}
${BIN_TARGET}
:
${OBJ}
@
echo
---
build executable file:
$@
$(CC)
$(OBJ)
-o
$@
${DIR_OBJ}/%.o
:
${DIR_SRC}/%.c
@
echo
---
build object file:
$@
$(CC)
$(CFLAGS)
-c
$<
-o
$@
RM
=
@echo 无法识别的平台。无法删除文件
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论