1 00:00:01,420 --> 00:00:05,763 We'll go into our test and we'll copy our digraph test. 2 00:00:10,600 --> 00:00:13,810 We'll change this to trigraph. 3 00:00:13,810 --> 00:00:18,860 And we'll need a trigraphed word. 4 00:00:18,860 --> 00:00:20,010 I'll use streak. 5 00:00:22,010 --> 00:00:25,510 The expected output will be eakstray. 6 00:00:27,680 --> 00:00:28,870 And let's run our test again. 7 00:00:31,840 --> 00:00:34,935 As expected, our third test fails. 8 00:00:34,935 --> 00:00:37,385 And we can see that it only moved 9 00:00:37,385 --> 00:00:40,955 the first two letters instead of the first three. 10 00:00:42,525 --> 00:00:46,725 Back in our converter, we'll start by adding our trigraph array. 11 00:00:48,680 --> 00:00:54,538 Then we can add a new variable for firstThreeLetters. 12 00:00:54,538 --> 00:01:00,690 Substring, the word, 13 00:01:00,690 --> 00:01:04,650 start at the beginning, and give the first three letters. 14 00:01:04,650 --> 00:01:08,710 Next, we can copy our if statement to create an else if. 15 00:01:11,880 --> 00:01:19,242 We'll change to first, Three letters, and first three letters. 16 00:01:22,200 --> 00:01:27,320 Start at the third character, and use our trigraph. 17 00:01:27,320 --> 00:01:28,670 And now let's run our test again. 18 00:01:30,720 --> 00:01:34,290 We get our same failure, but why? 19 00:01:34,290 --> 00:01:39,320 Again, in our expected results, compared to our actual results, 20 00:01:39,320 --> 00:01:44,170 we see that only the first two letters of streak has been moved. 21 00:01:44,170 --> 00:01:48,040 That's because we're checking for digraphs first. 22 00:01:48,040 --> 00:01:50,840 An ST is a digraph. 23 00:01:50,840 --> 00:01:53,850 And STR is a trigraph. 24 00:01:53,850 --> 00:01:58,120 Our test helps keep us from introducing a bug into our code. 25 00:01:58,120 --> 00:02:01,230 And it also help this diagnose what the problem was. 26 00:02:02,310 --> 00:02:10,178 We need to move our trigraph check before our di-graph check. 27 00:02:16,054 --> 00:02:17,603 Now let's run our test again. 28 00:02:20,103 --> 00:02:22,033 And this time they all pass.