Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


CSCI 2134 Assignment 3


Objectives

Practice debugging code, using a symbolic debugger, and fixing errors.


Preparation:

Clone the Assignment 3 repository

https://git.cs.dal.ca/courses/2021-fall/csci-2134/assignment3/????.git

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 an online auction system. Your boss has fired the previ-ous 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!

An auction is a way to sell one or more items. Items are grouped into lots for the auction; an auction can have several lots and each lot has one or more item in it. During the period of an auction, individuals state a price, called a bid, they are willing to spend to buy a specific lot. At the end of the auction period, the individual with the highest bid on a lot gets all the items in the lot for the bid value. During an auction period, an individual can place multiple bids on a lot and they cannot withdraw or rescind a bid once it is made.

You will be provided with a full buggy codebase for the auction, 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 abso-lutely need to understand it and the code you are debugging. The main method for the pro-gram is in TestHarness.java. 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:

Auction.java

Bidder.java

Lot.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 testfiles 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:


Hints

1. You will need to use a symbolic debugger to make headway. Using print-statements will be possible but extremely painful.

2. You will need to step through the code to find the bugs.

3. There are about 4-5 bugs in the code (in addition to the ones identified by the unit tests). The single bug report should cover all of them.