Below you will find pages that utilize the taxonomy term “test”

Posts

# Using Subtests in Go (Golang)

What is subtest? Go 1.7 introduced the concept of subtest for better handling of failures, and fine-grained control of which tests to run. It is the standard way of grouping tests that test same function/logic with multiples cases and leads to simpler and more maintainable tests. It used to be mostly done using table-driven test pattern till now.
In this post we’ll write tests for Singly Linked List which we covered in earlier post.

Posts

# Insertion Sort in Go (Golang) with test

What is Insertion Sort? Insertion sort is one of the simplest sorting algorithm. It breaks the input into sorted and unsorted list, picks next element from unsorted list and puts it into right place in sorted list.
Let’s break this down into concrete steps -
iterate over the array n - 1 times that is from index 1 to n-1 in each iteration let’s say i, pick i+1th element and put it into existing sorted list [0, i] such that the resultant list [0, i+1] is also sorted Implementation Let’s create a new directory inside $GOPATH/src.

Posts

# Bubble Sort in Go (Golang) with test

What is Bubble Sort? Quoting from wiki -
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent pairs and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.
So the idea is to bubble up the smallest value in each iteration. Let’s break this down into concrete steps -