Now that we have some methods implemented in.
It is time for us to test them.
So we need to create some tests.
So we will say mod test and now we will say use super.
And then we just want to take everything that we have implemented in thus far and now we want to create
a test.
So we will call it basics, since we are just testing our basic functions here and we want to create
a new mutable list since we are going to be adding and removing elements.
So we will create a new list.
So the first thing we want to do is check if empty list behaves correctly.
So we will use the assert equals macro and we will say list dot pop.
And if we pop an empty list, then we should have none returned.
Now we want to populate the list and we will say list dot push and we're going to copy and paste this
a couple more times and we will put in one, two and three.
And now we want to check normal.
Removal by using a pop.
So again, we will say assert equals.
We will list dot pop.
We know that we get a value return some value.
So since three was the last value we pushed in, we expect that to be popped.
And if we pop again, we expect some two to be returned since three is no longer in the list.
Another test we would say push some more values on and now we want to say list dot push for and list
dot push five.
Let's go ahead and check our removal again.
So now we want to say we want to pop.
We expect five pop again.
We expect four to be removed.
And now let's do exhaustive
removal check.
So now that we know that four and five are gone, let's just go ahead and pop the rest of them.
So now we expect some one to be returned.
And if we do it again one more time with one no longer being in there, we now expect none to be returned.
So let's just go over this real quick.
So we're going to check to make sure an empty list behaves correctly.
With a new list being created.
We expect if we pop something that none is returned, we're going to use push to populate some values.
So we want to then pop to make sure three was the last value we got pushed on.
And then we want to pop again to make sure two was pushed before three.
Then let's push a couple more values on.
So now our list should be one, four, five.
We want to pop and then pop again.
So then five and four are gone.
And now let's just make sure we can pop one.
And then if we pop one more time, we want to make sure our list is now empty again.
So if we run cargo test, we see that we have an error.
And it is saying we need to add a semicolon somewhere.
Let's see if that is our issue cargo test.
And we see that our test were completed successfully.
They are one test pass, which means everything inside of our test ran successfully and we have no failures.
So it looks like our three methods are running correctly.
So now that we know that we have a functioning linked list, let's begin implementing in a couple more
methods and also look at some unique use cases that we need to account for.