Skip to content

Instantly share code, notes, and snippets.

Avatar
🐹
Hey! Ho! Let's Go!

Artem Nikolaiev Tamplier2911

🐹
Hey! Ho! Let's Go!
View GitHub Profile
@posener
posener / go-table-driven-tests-parallel.md
Last active Jan 25, 2022
Be Careful with Table Driven Tests and t.Parallel()
View go-table-driven-tests-parallel.md

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
@scriptonian
scriptonian / bst-remove.js
Created Sep 11, 2017
Javascript Binary Search Tree - Remove
View bst-remove.js
BinarySearchTree.prototype = {
//other code here
remove: function(key) {
/*
First we find out if the node exists. If it doesn't exist, we return null and exit the function
*/
if(bst.root === null) {
return false;
}
@tpae
tpae / Trie.js
Created Nov 20, 2016
Trie.js - super simple JavaScript implementation
View Trie.js
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// -----------------------------------------
// we start with the TrieNode
function TrieNode(key) {
// the "key" value will be the character in sequence
this.key = key;