## What tests would you write for this function?

A bakery is using software to fine tune how many pies to bake each day. It doesn’t want to run out of pies to sell, but it also doesn’t want too many pies left unsold at the end of the day.

Test a function get_change_in_number_of_pies_to_bake. The function:

- Takes the number of pies leftover at the end of the day yesterday
- Returns the change in the number of pies we should bake today

The algorithm for the change in the number of pies to bake is:

- If 0 pies were left over, increase the number of pies we bake by 40
- If 1-20 pies were left over, don’t change how many pies we bake
- If more than 20 pies were left over, reduce the number of pies we bake today by: the amount of pies left over yesterday, minus 20

Examples:

Input and output are both integers.

##
Now how would you test *this* function?

We have a function to find the nth decimal digit of Pi, and we want to make sure it works.

The function is one-based starting with the first decimal. So the first decimal digit is 1, the second is 4, the third is 1, and so on:

Examples:

## How many scenarios do we need to test for this function?

get_cake_price determines what to charge for a cake. It has 3 parameters:

(writing is what we'll write on the cake.)

Here's how the values are set by the user:

- size is a radio button. 1-10 guests is selected by default.
- writing is a text input field, limited to 30 characters. The field is blank by default.
- pickup_time is selected from a calendar, limited to times when the bakery is open. The calendar does not go back in time. Tomorrow at 6:00 pm is selected by default.

And here’s how we determine the cost of a cake:

- $45 for 1 to 10 guests
- $75 for 11 to 20 guests
- +$15 for writing
*and*same day pickup