1
00:00:00,000 --> 00:00:04,900
My discount function has 100% line coverage.

2
00:00:05,000 --> 00:00:10,040
Apparently, we now owe the customer $1,900.

3
00:00:10,220 --> 00:00:13,000
Your only test uses zero percent off.

4
00:00:13,000 --> 00:00:16,900
It runs every line, but the broken formula still returns 100.

5
00:00:16,900 --> 00:00:19,340
Green test. Wrong confidence.

6
00:00:19,520 --> 00:00:24,000
So 100% means every line ran,

7
00:00:24,000 --> 00:00:26,080
not every case works?

8
00:00:26,260 --> 00:00:28,000
Exactly. Add a real discount:

9
00:00:28,000 --> 00:00:31,000
20% off 100 must be 80.

10
00:00:31,000 --> 00:00:34,000
The test fails: minus 1,900.

11
00:00:34,000 --> 00:00:35,000
Percent means out of 100.

12
00:00:35,000 --> 00:00:37,500
Divide 20 by 100 to get 0.2.

13
00:00:37,680 --> 00:00:41,000
Now the formula gives 100 times 0.8: 80.

14
00:00:41,000 --> 00:00:43,000
Keep both tests.

15
00:00:43,000 --> 00:00:45,000
Coverage finds unrun code;

16
00:00:45,000 --> 00:00:46,800
assertions check the results you chose.

17
00:00:46,980 --> 00:00:48,000
Great.

18
00:00:48,000 --> 00:00:51,000
The code had perfect attendance.

19
00:00:51,000 --> 00:00:52,900
Failed math.
