Hopefully you were able to successfully set up some test cases in order to test the methods that we
implemented and the last lecture.
So we are now going to go over my test cases for our methods.
So the first thing that we need to do is just set up where we conduct our tests.
So we will give it our config tests and we will call it mod test and we will bring in our Q into scope.
For our first test, we're going to actually be able to test two methods that we implemented.
We're going to be able to test in adding in a couple of values and then also test our is empty method.
So let's go ahead and do that by creating a new queue,
adding in some values.
So we will say one
and two, and if we successfully add it in values, then our assert equals on Q dot is empty should
return false.
So if we successfully added in values, then our test should return false if we're looking to see if
it is empty or not.
So now we are going to test our DK method and this is going to let us see if we are returning values
correctly when we take them out of the queue.
So we need to create our queue again.
We need to add in some values.
So again, we get a test out on Q method even more.
And now we can test if values are correctly taking out of the queue.
So when we run queue dot dx queue, we expect this to be some one.
Our next test, we will evaluate peaking.
So let's create our queue.
Equals Q new.
And here we will add in our typical values of one and two.
And when we do our assert equals, we will cue dot peak.
And we expect some and a reference to the one to be returned.
And then for our next test case, we will test out our length.
So we will say let mute queue is equal to a new queue.
We will add in a value add in our next value and we will assert equals q dot
length and check that it equals to two.
So let's make sure we have tested all of our methods.
So we did new and Q dx Q peak length and is empty.
So if we run this, we would expect everything to pass successfully, which is what we got.
So hopefully you are able to see that implementing a Q is very similar to implementing an A stack.
And the key difference between a stack and a Q is the order in which values are put in and taken out
a stack.
Is LIFO meaning last in, first out and a Q is FIFO first in, first out?
So if you have any questions about my implementation or even one of your implementations, please feel
free to ask them in the Q&A section.