Design an oracle for the following JavaScript function.
2. Generate a test case set for this function and provide a coverage analysis report for your test case set.
The JavaScript function:
function purchaseSong(username, password, songId) {
// first authenticate the user
if (checkCredentials(username, password) == false) {
alert('The username or password is incorrect.');
return;
}
// get the price of the song
var songPrice = getSongPrice(songId);
// make sure the user has enough money in his account
if (getAccountBalance(username) < songPrice) {
alert('You do not have enough money in your account.');
return;
}
// debit the user's account
debitAccount(username, songPrice);
// start downloading the song to the client machine
downloadSong(songId);
}
Notice: You may note that the user could be malicious and try to modify the JavaScript. Your oracle and test case should reflect this fact.