[Dlang Episode 102] unittest 2 of n - Test Techniques (Pure, Whitebox, Blackbox, __ctfe, more)

Опубликовано: 22 Октябрь 2024
на канале: Mike Shah
280
23

►Full DLang Series Playlist:    • D Language (DLang) Programming  
►Find full courses on: https://courses.mshah.io/
►Join as member to get perks:    / @mikeshah  

►Lesson Description: In this lesson I show you some testing techniques in the D programming language. The unittest block again is a simple feature, but we can combine it with things that we have learned before, like the 'pure' attribute. A good unittest usually does not need state from the outside world, so making a unittest pure is a good idea. After this, I then talk about whitebox and blackbox testing, which informs us of how to write a test based on what knowledge we have of the implementation. Then I talk about using 'assertThrown' to capture if an exception is thrown. Finally, I reiterate that we can catch code that executes at compile time or run-time with assert and static assert (this gives a brief introduction to __ctfe). As always, share your interesting use cases with the community in the discussion below!

►Please like and subscribe to help the channel!
►YouTube Channel:    / mikeshah  
►Join our free community: https://courses.mshah.io/communities/...