We want to search through an array of names and find the position of a particular name. The function should have two arguments, an array of names and the name we are looking for. The output will be the index where the name where found or an error will occur if the name was not found.
Write a class that tests the previous function.
Assert can be used to check wether the result has been found or not and if it has not been found, the message in the second argument will be shown otherwise.
We see that the name "Lisp" exist in the array and is on position 2.
When searching for a name that is not in the array, the simulation is aborted. We see in the dslog.txt that the assertion fails.