Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This assignment is not about writing programs, it is about testing them. You wil

ID: 653791 • Letter: T

Question

This assignment is not about writing programs, it is about testing them. You will write test input files and run existing programs, but you will probably not write any Java code for this assignment. You need to do both parts of this assignment.

Part 1 - White Box Testing: For my Abstract Algebra class one semester, I wrote a quickie calculator using BigInteger values. The program is BigCalc.java, which you should download to your machine.

Using the source code to guide you (since this is white box testing), produce a list of input lines which use every branch in the program. That is, each line of code should be executed in at least one test case. Also, every combination of trues and falses should be tested at each if-statement. I'm not worried about whether the BigInteger package is working correctly (I'm willing to trust it), so you can write your test cases using 1 and 2 digit numbers - you don't need to use huge ones.

The calculator is intended to handle raising one number to a power, computing a number mod another, and raising one number to a power mod another (raising to the power is done first, then the mod - actually, the BigInteger code sort of does it all at once). So, expected inputs would be things like:

For this part of the assignment you should hand in a list of input lines indicating:

which are calculated correctly,

which produce an error message from the BigCalc program (which then resets itself and is ready for the next input), and

which produce a run-time error from Java (in other words, my program crashes).

Of course, you determine these by running the program with your test inputs.

Part 2 - Black Box Testing: While I was helping our ACM-ICPC Programming Team prepare for the programming contest, I got interested in one of the problems described here. I wrote a program which works most of the time, but it may go into an infinite loop occasionally (I'm not sure). An executable jar file containing my program can be found here. You should download this file to your machine.

To run this program, you need to get a command line in the directory where the jar file is stored. Then the command java -jar BoringHW.jar should run the program. It expects input from System.in and writes to System.out. So, a very simple run would look like:

For a more complicated run, you would use I/O redirection. For instance, using the input file sample-in.txt and putting the output into sample-out.txt you would type:

The output file would then look like this. You should make sure you can produce that output before proceeding.

Since this is black box testing, you don't have access to the source code. Your job is to produce a collection of test cases which are likely to use various parts of the program. Usually this includes variations like a trivial case (a one node tree), nodes with children only on the left, only on the right, on both sides, and combinations of these, etc.

For this part of the assignment you should hand in a list of input lines indicating:

which trees are drawn correctly,

which trees are drawn incorrectly,

which put my program into an infinite loop, and

which produce a run-time error from Java (in other words, my program crashes).

You might not be able to find test inputs for all of these four cases. Find as many as you can.

Explanation / Answer

1. 23 2 mod
o/p - Unknown operation

2. 23 mod 2
o/p - 1

3. 2 ^ 3
o/p - 8

4. 2 mod 4 5
o/p - Unknown operation

5. 4 mod 3 ^ 2
o/p - 1

This program does not have provision to come out of it. There should be some provisoin to come out. Also when we provide as input it gives error. Otherwise the program is running wel.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote