What is the purpose of wearing white clothes in Test cricket?

Test format is the longest format of sports which is played for days. Not too ago, It wasn’t only of 5 days match but the game continued till the result was out. The longest documented international cricket test match was played between South