How to test your code


#1

Hi Guys,

So I stay in South Africa and we do not observe DST at all. So, my code would always say DST is not on - which is correct. However, if this was a real-world application, I would want to make sure my code works properly.

So on the Mac I changed my time zone to a country that observed DST and then re-ran my program.

This showed me the code works perfectly.

Just a small tip. :smiley:


#2

Well, a way you could test your code was check if a bool returned 0. Which would mean DST does not occur in your area. Just switch the bool to 1 and see if it still returns the correct value.