Unit testing in FP is a pure joy, especially when compared to regular C++ unit testing.
- [Instructor] One of the nice benefits…of functional programming is easier testing,…not having classes to mock or instantiate…makes testing simpler,…using pure functions whose outputs…solely depends on their inputs,…means the tests almost write themselves.…Let's take a quick look at unit testing a C++ program…written functionally.…We'll download the open source, Catch2, unit test framework.…So, here's the Catch2…website, we're going to scroll down…until we see the logo, and then, just past the logo,…there is a long blue link,…which says single header can be downloaded directly…using this link.…
We're going to click that.…That will download the catch.hpp file…to our machine,…and then, we're going to copy that catch.hpp file…to our working directory.…Yeah, we're going to go to Visual Studio Code,…and here, we have main.cpp plus catch.hpp.…This code uses the Catch2 unit test framework.…The define statement CATCH_CONFIG_MAIN…tells catch to create a main function.…
You only need to do this once.…Next comes, catch.hpp.…
- Unit testing and functional programming
- Function and Lambda functions
- C++ templates
- Working with the Standard Template Library and Boost.Hana
- Functional reactive programming
Skill Level Intermediate
2. Functional Programming in Modern C++
3. Template Metaprogramming
4. Functional Reactive Programming
RxCpp library5m 21s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.