# ans-check **Repository Path**: tonyddg/ans-check ## Basic Information - **Project Name**: ans-check - **Description**: 一个离线C++测试工具 - **Primary Language**: C++ - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-30 - **Last Updated**: 2021-10-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Intro: A Local-judge program for c++ in Linux. 介绍: 一个用于Linux平台离线C++测试工具 能够自动编译与运行源文件并与预设的输入输出文件进行比较 How to use: ./ans-check (workfield) (testname) (srcpath) (id) workfield: A container to put test set and tmporary environment if a folder chosen as the workfield, it must has two folders named testset and tmpenv. testset: A folder contains tests. tests: A tests should be a folder with two folders named in and out in it and settings.txt. tmpenv: Once test starts, a folder named env_(testname)_(id) will be created with the result file(result.txt) and compiled file. settings.txt: testname: the name of the test and need to be as the test's folder. compilingopt: Compiling option for g++. testpoint: The number of testpoints. timelimit: Limit time for a singal test, unit is second. memorylimit: Limit memory for a singal test, unit is KB. The workfield fold in source is used for testing. 如何使用: ./ans-check (工作文件夹路径) (测试名) (源文件路径) (id) 工作文件夹: 一个存放测试集合与临时环境的文件夹,需要包含testset与tmpenv两个子文件夹 testset: 测试集合文件夹 测试文件夹: 一个测试文件夹需要有 in 与 out 两个子文件夹以及设置文件 setting.txt tmpenv: 存放测试的临时环境,每次测试产生的临时子文件夹为 env_(测试名)_(id),其中包含了源文件编译得到的执行文件与存放结果的result.txt 关于settings.txt的说明 testname : 测试名称 compilingopt : g++的编译选项 testpoint : 测试点数 timelimit : 测试时间限制,单位秒 memorylimit : 测试内存限制,单位kb 源代码中附带的 workfield 文件夹为用于示例的工作文件夹 需要改进的地方: 使用fork和exec来运行被测试的文件,无法改变被测试文件的目录 导致测试时仍然以主目录为运行环境。