Putting It All Together

Put everything from the previous lessons in the chapter together and get familiarized with writing our own properties.

To get started with writing our own properties, it may be useful to compare them with the type of tests we’d already have in place in an existing project. We’ll start with a simple function, one that finds the largest element in a list. Coming up with properties isn’t easy, so beginning with regular tests can sometimes be a good idea since it can help us flesh out what we think the code should be doing.

Standard testing

Standard unit tests would probably look a bit like this, using the EUnit syntax:

Get hands-on with 1200+ tech skills courses.