脚本宝典收集整理的这篇文章主要介绍了第一次个人编程作业,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这个作业属于哪个课程 | 软件工程 |
---|---|
这个作业要求在哪里 | 个人项目作业 |
这个作业的目标 | 设计论文查重算法+应用PSP表格+单元测试+ JPRofiler 性能分析+GIT管理 |
PSP2.1 | PErsonal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
---|---|---|---|
Planning | 计划 | 25 | 30 |
· EstiMATE | · 估计这个任务需要多少时间 | 10 | 20 |
Development | 开发 | 300 | 360 |
· Analysis | · 需求分析 (包括学习新技术) | 60 | 120 |
· Design Spec | · 生成设计文档 | 30 | 40 |
· Design review | · 设计复审 | 10 | 10 |
· Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 15 | 15 |
· Design | · 具体设计 | 60 | 60 |
· Coding | · 具体编码 | 240 | 300 |
· Code Review | · 代码复审 | 60 | 120 |
· test | · 测试(自我测试,修改代码,提交修改) | 120 | 360 |
Reporting | 报告 | 60 | 120 |
· Test Report | · 测试报告 | 20 | 20 |
· Size Measurement | · 计算工作量 | 15 | 15 |
· Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 20 | 30 |
· 合计 | 1045 | 1620 |
参考资料:simhash算法及原理简介
采用SimHash算法:SimHash算法分为 5 个步骤:分词、hash、加权、合并、降维。
整体算法流程图:
算法独到之处:
IOText 类:读取或写入文件
Main 类:调用函数并输出结果
SimHash 类:计算文本相似度的核心算法工具类
PathInput 类:分别输入测试文件路径和输出路径,输出结果
MyTest 类: 测试类
关系流程图:
关键函数simHash()流程图:
对原文件的添加、删除、修改、文件不存在或路径错误、文件内容为空等进行测试。
package paperpass;
import org.junit.jupiter.api.Test;
class MyTest {
String origin = "text2\orig.txt";
String[] txtPath={
"text2\orig_0.8_add.txt",
"text2\orig_0.8_del.txt",
"text2\orig_0.8_dis_1.txt",
"text2\orig_0.8_dis_10.txt",
"text2\orig_0.8_dis_15.txt",
};
String[] htMLPath={
"text\orig_0.8_del.txt",
"text\orig_0.8_dis_1.txt", "text\orig_0.8_dis_10.txt",
"text\orig_0.8_dis_15.txt",};
String outPath = "output.txt";
Main txtCheck1 = new Main();
/**
*文本测试:
*原文件的添加
*/
@Test
public void addTest(){
txtCheck1.Test1(origin, txtPath[0],outPath);
}
/**原文件的删除*/
@Test
public void delTest(){
txtCheck1.Test1(origin, txtPath[1],outPath);
}
/**原文件的修改*/
@Test
public void dis_1Test(){
txtCheck1.Test1(origin, txtPath[2],outPath);
}
@Test
public void dis_10Test(){
txtCheck1.Test1(origin, txtPath[3],outPath);
}
@Test
public void dis_15Test(){
txtCheck1.Test1(origin, txtPath[4],outPath);
}
/**
* 对 html 进行测试
* */
@Test
public void html1Test(){
txtCheck1.Test1(origin, htmlPath[1],outPath);
}
@Test
public void html2Test(){
txtCheck1.Test1(origin, htmlPath[3],outPath);
}
/**html 和 html 进行测试*/
@Test
public void html3Test(){
txtCheck1.Test1(htmlPath[0], htmlPath[3],outPath);
}
/**
* 测试文本路径错误或不存在
* */
@Test
public void txtPathWrongTest(){
txtCheck1.Test1("text\orig_del.txt","text2\orig_dis_15.txt" ,outPath);
}
/**
* 输出文件路径错误或不存在
* */
@Test
public void outPathWrongTest(){
txtCheck1.Test1("text2\orig_0.8_del.txt","text2\orig_0.8_dis_10.txt","out_put.txt");
}
/**
* 测试文本为空
* */
@Test
public void emptyTest(){
txtCheck1.Test1("text2\empty.txt","text2\orig_0.8_dis_10.txt","output.txt");
}
可以看出,测试 html 耗时比 txt 文本的耗时久
部分代码
测试用例
测试结果
部分代码
测试用例
测试结果
部分代码
测试用例
测试结果
以上是脚本宝典为你收集整理的第一次个人编程作业全部内容,希望文章能够帮你解决第一次个人编程作业所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。