Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Input Space Partitioning method to generate test cases for the class BoundedQueue Signature public BoundedQueue (int capacity); // The maximum number of elements public

Use Input Space Partitioning method to generate test cases for the class BoundedQueue

Signature

  • public BoundedQueue (int capacity); // The maximum number of elements

  • public void enQueue (Object X);

  • public Object deQueue ();

  • public boolean isEmpty ();

  • public boolean isFull ();

Assume the usual semantics for a queue with a fixed, maximal capacity.

What to submit for Part I: a pdf file containing

(a) List of all the input variables, including the state variables.

(b) Characteristics of the input variables (Make sure you cover all input variables)

(c) Blocks that partition the characteristics.

(d) One block in each partition designated as the Base block.

(e) Values for each block.

(f) Test suite that satisfies Base Choice Coverage (BCC)

Remember that a test suite is a set of test cases and a test case contains both the input to be used with that test, but also the expected output or better the test oracle (i.e., what you will be checking with that test case).

part 1 should be in a table similar to the one below

image text in transcribed

code

public class BoundedQueue

{

// Overview: a BoundedQueue is a mutable, bounded FIFO data structure

// of fixed size , with size being set in the constructor

// A typical Queue is [], [o1], or [o1, o2], where neither o1 nor o2

// are ever null. Older elements are listed before newer ones.

private final Object[] elements;

private int size, front, back;

private final int capacity;

public BoundedQueue (int capacity)

{

if (capacity

throw new IllegalArgumentException ("BoundedQueue.constructor");

this.capacity = capacity;

elements = new Object [capacity];

size = 0; front = 0; back = 0;

}

public void enQueue (Object o)

throws NullPointerException, IllegalStateException

{ // Modifies: this

// Effects: If argument is null throw NullPointerException

// else if this is full, throw IllegalStateException,

// else make o the newest element of this

if (o == null)

throw new NullPointerException ("BoundedQueue.enQueue");

else if (size == capacity)

throw new IllegalStateException ("BoundedQueue.enQueue");

else

{

size++;

elements [back] = o;

back = (back+1) % capacity;

}

}

public Object deQueue () throws IllegalStateException

{ // Modifies: this

// Effects: If queue is empty, throw IllegalStateException,

// else remove and return oldest element of this

if (size == 0)

throw new IllegalStateException ("BoundedQueue.deQueue");

else

{

size--;

Object o = elements [ (front % capacity) ];

elements [front] = null;

front = (front+1) % capacity;

return o;

}

}

public boolean isEmpty()

{

return (size == 0);

}

public boolean isFull()

{

return (size == capacity);

}

}

Partition B1 B2 B3 B4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions