Skip to content

Instantly share code, notes, and snippets.

@nettle
nettle / string_stream_benchmark.py
Created July 18, 2019 12:38
Python: string concatenation benchmark
"""
String concatenation benchmark
Standard python string concatenation
vs custom (StringStream based on StringIO)
vs io streams (cStringIO, StringIO, io.BytesIO)
Test text: https://www.lipsum.com/
Word wrap: https://appzaza.com/word-wrap
"""
@nettle
nettle / testsuite.cc
Created August 1, 2019 12:04
Minimal C++ TestSuite
#include <iostream>
#include <string>
#include <vector>
// Test suite controls test execution
class TestSuite {
public:
// Abstract test case
class TestCase {
public:
@nettle
nettle / test_sample.py
Created August 6, 2019 15:03
TestCase sample which loads module from directory above
"""
TestCase sample which loads module from directory above
implementing the following directory structure:
sample.py
test/test_sample.py
"""
import imp
import os
import sys
import unittest