第四周WordCount优化
一、GitHub地址
https://github.com/kawoyi/Advanced-WordCounter最终由组长整合的组长github
二、psp表格

三、个人模块及实现
我负责的是输入模块,由FileUnit类里的readFile函数进行文件读取输入
public class FileUnit
{
public static void fileWriter(String outputpath,Map<String,Integer> map)throws IOException
{ //结果写到输出文件中
File file=new File(outputpath);
FileWriter fw = new FileWriter(file,false);
BufferedWriter bw = new BufferedWriter(fw);
List<Map.Entry<String,Integer>> list = new ArrayList<Map.Entry<String,Integer>>(map.entrySet());//实现按Value排序
//然后通过比较器来实现排序
Collections.sort(list,new Comparator<Map.Entry<String,Integer>>()
{
//降序排序
public int compare(Entry<String, Integer> o1,
Entry<String, Integer> o2)
{
int p1=o1.getValue();
int p2=o2.getValue();
int p=p1-p2;
if(p>0)
{
return -1;
}
else if(p==0)
{
return 0;
}
else
return 1;
}
});
for (Map.Entry<String, Integer> mapping:list)
{ //向result.txt写结果
int temp=0;
if(temp<100)
{
bw.write( mapping.getKey() + " " + mapping.getValue());
bw.newLine();
}
temp++;
}
bw.close();
}
public static void readFile(String filepath,StringBuffer buffer) //读取文件
{
try {
FileReader fis = new FileReader(filepath);
BufferedReader br = new BufferedReader(fis);
int temp=-1;
while ((temp = br.read()) != -1) {
buffer.append((char)(temp));
}
} catch (FileNotFoundException e) {
System.out.println("源文件未找到!");
e.printStackTrace();
} catch (IOException e) {
System.out.println("读写文件出现异常!");
e.printStackTrace();
}
}
}
四、测试用例设计及测试结果
测试程序对文件内容的识别分割是否正确,对各种情况下的单词进行测试,
包括纯字母单词,大写字母单词,字母和连字符组成的单词,字母和数字组成的单词,由空格分隔的单词,由符号分割的单词等等情况。
运用白盒测试的方法测试该程序是否能按照需求来识别文件标题,而对于20个测试用例来讲10个不到也足以覆盖要求,后续的文件内容采用了黑盒测试的方式偏重于考虑各类输出会出现的结果,总共20个数量较多,这里就只放出截图。

五,测试用例运行截图

由于总数过多只放出了其中一个的截图
六、小组贡献
0.25
第四周WordCount优化的更多相关文章
- HUST软测1504班第4周小组作业成绩:WordCount优化
说明 本次公布的成绩为第四周作业的结果: 第4周小组作业:WordCount优化 博客推荐:本次作业有一位同学完成有创意,推荐优秀博客.(优秀博客不会对成绩带来正面或者负面影响)PS:做任何创新的任务 ...
- 第四周小组作业:Wordcount优化
1.小组github地址 https://github.com/muzhailong/wcPro 2.PSP表格 PSP2.1 PSP阶段 预计耗时(分钟) 实际耗时(分钟) Planning 计划 ...
- WordCount优化-第四周小组作业
一.基本功能 GITHUB项目地址:https://github.com/LongtermPartner/ExtendWordCount PSP表格填写: PSP2.1 PSP阶段 预估耗时 (分钟) ...
- WcPro项目(WordCount优化)
1 基本任务:代码编写+单元测试 1.1 项目GitHub地址 https://github.com/ReWr1te/WcPro 1.2 项目PSP表格 PSP2.1 PSP阶段 预估耗时(分钟) 实 ...
- WordCount优化
Github 地址:chaosrings/wcPro 1.PSP2.1表格 psp 2.1 psp阶段 预估耗时(分钟) 实际耗时(分钟) Planning 计划 10 10 Estimate 估计这 ...
- WordCount 优化版测试小程序实现
Stage1:代码编写+单元测试 Github地址: https://github.com/245553473/wcPro.git PSP表格: PSP PSP阶段 预估耗时(分钟) 实际耗时(分钟) ...
- 软件测试第4周小组作业:WordCount优化
一.基本任务:代码编写+单元测试 1.Github地址: https://github.com/Wegnery/New_WordCount 2.PSP2.1表格 PSP2.1 PSP阶段 预估耗时 ( ...
- WordCount优化版测试小程序实现
Github地址:https://github.com/hcy6668/wordCountPro.git PSP表格: PSP PSP阶段 预估耗时(小时) 实际耗时(小时) Planning ...
- 第4周小组作业:WordCount优化
Github项目地址:https://github.com/chaseMengdi/wcPro stage1:代码编写+单元测试 PSP表格 PSP2.1 PSP阶段 预估耗时(分钟) 实际耗时(分 ...
随机推荐
- Windows Server(r12) - 配置 MySQL 远程访问
Windows Server(r12) - 配置 MySQL 远程访问 工作主要为两部分, 一部分是 Windows 防火墙, 一部分是 MySQL 自身 Windows 端口远程访问 其实就是在 W ...
- vue源码分析—认识 Flow
认识 Flow Flow 是 facebook 出品的 JavaScript 静态类型检查⼯具.Vue.js 的源码利⽤了 Flow 做了静态类型检查, 所以了解 Flow 有助于我们阅读源码 Flo ...
- 【es6】数组排重
let set = new Set([1,2,3,4,4,4,4,4]); console.log( Array.from(set) ); //输出:[ 1, 2, 3, 4 ]
- VSC 解决红底线问题
话不多说 设置里代码奉上 { "editor.minimap.enabled": false, "workbench.iconTheme": "vs ...
- mange
from flask import Flask app = Flask(__name__) manager = Manager(app) 1. 重写Command class ShellCommand ...
- Vue 路由心得总结
一. 嵌套路由 a.主页面, main.vue , 子页面分别为 shouye.vue / liuyan.vue / about.vue , 首先, 在main.vue加入导 ...
- Django Models 查询操作
1.准备数据表: from django.db import models class City(models.Model): name=models.CharField(max_length=32) ...
- python之路8-内置模块介绍
time & datetime模块 1 #_*_coding:utf-8_*_ 2 __author__ = 'Alex Li' 3 4 import time 5 6 7 # print(t ...
- 关键字:This(上)
对象初始化内存图: this 是一个关键字,表示对象本身,本质上this中存有一个引用,引用对象本身. this用于访问本对象属性,同时解决局部变量和成员变量同名的问题(接有参构造中第二种解决方案.. ...
- Go语言中的make和new
相同点: make和new都是用来创建分配类型内存的. 不同点: 先看下面的代码 package main import "fmt" func main(){ var i *int ...