CSCI 2134

BackendDev
• 阅读 860

CSCI 2134 Assignment 3
Due date: 11:59pm, Friday, March 19, 2021, submitted via Git
Objectives
Practice debugging code, using a symbolic debugger, and fixing errors.
Preparation:
Clone the Assignment 3 repository
https://git.cs.dal.ca/courses...
where is your CSID.
Problem Statement
Take a piece of buggy code, debug it, and fix it.
Background
You have inherited some buggy code for computing shortest path solutions to the board game
Ticket to Ride. Your boss has fired the previous developer because they did not do any testing
and did not fix the bugs! She has hired you to debug and fix the code. She will provide you with
some unit tests (some of which fail), sample input and sample output of what should be produced.
Your job is to fix the bugs: Both the bugs exhibited by the unit tests and the ones by the
input. Good luck!
You will be provided with a full buggy codebase for JSON comparison, a specification, a set of unit
tests using JUnit5, sample input and expected output. Your job is to identify and fix all the bugs.
Given a game board of rail segments and a list of routes (pairs of cities), the code is supposed to
compute the total cost of building a network between the given routes, assuming that the shortest
distance for each route is chosen. This can be computed by computing shortest paths for each
route using Dijkstra’s shortest path algorithm.
You will be provided with a full buggy codebase for distance computation, a specification, a set
of unit tests using JUnit5, sample input and expected output. Your job is to identify and fix all
the bugs.
Task

  1. Review the specification (specification.pdf) in the docs directory. You will absolutely
    need to understand it and the code you are debugging. The main method for the program
    is in RouteCost.java. Note that your boss finally got the buggy makeTree method in
    City.java from the previous developer. Spend some time tracing through the code and creating
    a diagram of how the classes and code are put together. This will help you a lot later on!
  2. Fix all bugs that are identified by the tests generated by the unit tests in the following classes:
    • City.java
    • CityComparator.java
    • Link.java
  3. See buglist.txt file in the docs directory. One sample entry is included. For each bug
    that you fix add an entry to this file that includes:
    a. The file/class name where the bug was.
    b. The method where the bug was
    c. The line number(s) where the buggy code was
    d. A description of what the bug was
    e. A description of what the fix was.
  4. The previous developer made a set of example input and expected output in the input_tests
    directory. These tests will likely not pass yet even after fixing the bugs identified
    by the unit tests.
    • See the README.txt in this directory for help running the tests. The easiest method is to
    copy your .java files from src to this directory and run the test.sh script in a terminal or git
    bash command line shell.
    • Compare the output in the .out files with the expected .gold files.
    • For each output that differs from the expected output, debug the code and determine
    the reason for the mismatch. Fix any identified bugs missed by the unit tests.
  5. Record any new bugs found and fixed from Step 4 in the previously created buglist.txt
  6. Commit and push back the bug fixes and the buglist.txt file to the remote repository.
    Submission
    All fixes and files must be committed and pushed back to the remote Git repository.
    Grading
    The following grading scheme will be used:
    Task 4/4 3/4 2/4 1/4 0/4
    Bugs found
    [unit tests]
    (20%)
  7. to 5 bugs are
    correctly identified
    and documented.
    Three (3) bugs
    are correctly
    identified and
    documented.
    Two (2) bugs
    are correctly
    identified and
    documented.
    One (1) bug is correctly
    identified
    and documented.
    Zero (0) bugs
    are correctly
    identified and
    documented.
    Bugs fixed
    [unit tests]
    (20%)
  8. to 5 bugs are
    correctly fixed.
    All unit tests
    pass.
    Three (3) bugs
    are correctly
    fixed.
    Two (2) bugs
    are correctly
    fixed.
    One (1) bug is correctly
    fixed.
    Zero (0) bugs
    are correctly
    fixed.
    Bugs found
    [input tests]
    (20%)
  9. to 3 bugs are
    correctly identified
    and documented.
    N/A One (1) bug is
    correctly identified
    and documented.
    N/A Zero (0) bugs
    are correctly
    identified and
    documented.
    Bugs fixed
    [input tests]
    (30%)
  10. to 3 bugs are
    correctly fixed.
    All input tests
    pass.
  11. to 3 bugs are
    correctly fixed.
    One (1) bug is
    correctly fixed.
    Some input
    tests pass
    N/A Zero (0) bugs
    are correctly
    fixed.
    Document
    [buglist.txt]
    Clarity
    (10%)
    Document
    looks professional,
    includes
    all information,
    and easy to
    read
    Document looks
    ok. May be
    hard to read or
    missing some
    information.
    Document is
    sloppy, inconsistent,
    and has
    missing information
    Document is very
    sloppy with significant
    missing information
    Document is
    illegible or not
    provided.
    Hints
  12. You will need to use a symbolic debugger to make headway. Using print-statements will be
    possible but extremely painful.
  13. You will need to step through the code to find the bugs.
  14. There are about 2-3 bugs in the code (in addition to the ones identified by the unit tests). The
    single bug report should cover all of them.
    WX:codehelp
点赞
收藏
评论区
推荐文章
blmius blmius
4年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
Wesley13 Wesley13
4年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
双十一预售活动分析
2022年双十一促销活动已经开始,大家应该都提前开始关注今年双十一活动的时间表了吧?2022年10月24日晚8:00天猫双11预售时间,第一波销售时间10月31日晚8:0,第二波销售时间11月10日晚8:00;天猫双11的优惠力度是跨店每满30050
Stella981 Stella981
4年前
List的Select 和Select().tolist()
List<PersondelpnewList<Person{newPerson{Id1,Name"小明1",Age11,Sign0},newPerson{Id2,Name"小明2",Age12,
Wesley13 Wesley13
4年前
VBox 启动虚拟机失败
在Vbox(5.0.8版本)启动Ubuntu的虚拟机时,遇到错误信息:NtCreateFile(\\Device\\VBoxDrvStub)failed:0xc000000034STATUS\_OBJECT\_NAME\_NOT\_FOUND(0retries) (rc101)Makesurethekern
Wesley13 Wesley13
4年前
FLV文件格式
1.        FLV文件对齐方式FLV文件以大端对齐方式存放多字节整型。如存放数字无符号16位的数字300(0x012C),那么在FLV文件中存放的顺序是:|0x01|0x2C|。如果是无符号32位数字300(0x0000012C),那么在FLV文件中的存放顺序是:|0x00|0x00|0x00|0x01|0x2C。2.  
Wesley13 Wesley13
4年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
4年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Wesley13 Wesley13
4年前
Java日期时间API系列36
  十二时辰,古代劳动人民把一昼夜划分成十二个时段,每一个时段叫一个时辰。二十四小时和十二时辰对照表:时辰时间24时制子时深夜11:00凌晨01:0023:0001:00丑时上午01:00上午03:0001:0003:00寅时上午03:00上午0
Wesley13 Wesley13
4年前
MBR笔记
<bochs:100000000000e\WGUI\Simclientsize(0,0)!stretchedsize(640,480)!<bochs:2b0x7c00<bochs:3c00000003740i\BIOS\$Revision:1.166$$Date:2006/08/1117
BackendDev
BackendDev
Lv1
看不清的挽留,正如你执着地向前走
文章
4
粉丝
0
获赞
0