Testing in Go by Example: Part 6

 • 
September 25, 2017
Tags

For this installment of the Testing in Go series we'll be talking about a grouping of packages that facilitate general-purpose comparisons in various contexts. Since the most common context is testing it seemed like this series was the right place for the discussion.

We generally refer to these comparison functions as assertions (cue ominous background music and spooky sound effects). You may have already read the opinions found on the Golang FAQ related to assertions.

"Why does Go not have assertions?"

Go doesn't provide assertions. They are undeniably convenient, but our experience has been that programmers use them as a crutch to avoid thinking about proper error handling and reporting. Proper error handling means that servers continue operation after non-fatal errors instead of crashing...

"Where is my favorite helper function for testing?"

Go's standard testing package makes it easy to write unit tests, but it lacks features provided in other language's testing frameworks such as assertion functions. An earlier section of this document explained why Go doesn't have assertions, and the same arguments apply to the use of assert in tests.

In general, we agree that in many scenarios a single assertion failure shouldn't prevent a test from running. So, by default the assertion functions we use don't do that. Problem solved.

Subscribe to our blog!
Learn more about RSS feeds here.
Subscribe Now
Get our latest eBook!
Evaluating a geocoding tool?
Get the buyer's guide
smarty logo
Download now
Read our recent posts
Does Santa Use Smarty’s Rooftop Geocoding?
Arrow Icon
You bet he does. He kinda has to, there’s no other way he can get rooftop-accurate geocoding fast enough. The man travels the entire world in 14 hours and needs to know exactly where to land his reindeer. Look, for a lot of people’s needs you could say that “parcel centroid” is good enough when it comes to address geocoding. Many houses are in fact in the center of the parcel. However, there are also many homes that are not in the center of the parcel. Inaccurate Geocode: Accurate Geocode: For example, think of apartment buildings.
Common Problems When Working with Address Data
Arrow Icon
There are many problems you may run into if you're working with address data. In our recent webinar, our own Adam Charlton went over some of the challenges he's encountered the most, and how to deal with them. Here’s some of what he talked about. You can view the full recording at the link below. Standardization Standardizing addresses helps solve many of the problems inherent with data blending (combining two or more address databases together). In order to properly blend different address databases together you need to either have an external ID correlate the two sources, or have identically formatted address fields.
Rising Parcel Shipping Costs in 2022: How to Cut Your Shipping Expenses
Arrow Icon
Parcel shipping costs have been rising since 2020. We’ve all seen inflation on the consumer end, whether we’re checking out online or paying at the gas pump. And skyrocketing freight rates have made headlines. Today, we’re going to focus on the impact of the increasing cost of shipping on your business and what you can do about it. But don’t lose hope—while we’re going to explore climbing shipment costs in this article, we’ll also chat about what your business can do to make shipping more efficient.

The leader in location data intelligence

Ready to get started?