Qt Test limitations and workarounds

| category: Testing | author: st

Pros and cons

Why use Qt Test for unit testing and TDD (test-driven development)?

  • small testing framework (about 6K lines of source code);
  • seamless integration with QtCreator development environment;
  • full support of Qt framework including classes/types and signal/slots;
  • simple to start and use.

However, there are some drawbacks …

C++11 containers: move semantic vs pointers

| category: Testing | author: st
Tags: ,


C++11 has introduced the move semantic which can also be used in containers instead of "old-school" pointers. The specific containers owning objects has been proposed earlier by third-party libraries like Boost (for example, ptr_map or ptr_vector).

The goal of the test is to compare the speed of manipulations …

SQL Server: key-value store table and hash index

| category: Testing | author: st
Tags: ,

Hash indexes are used as entry points for memory-optimized tables; both features were introduced in SQL Server 2014. Let's look at index performance in scenario "key-value store".

Scenario and environment

The table stores a significant volume (about 10 millions rows) of pairs key-value. The key is of integer type and …

Happy tickets benchmark

| category: Testing | author: st
Tags: , , ,

Some countries have integer numbers printed on the transport tickets, for example, in ex-USSR. The ticket is "happy" when the sum of the first half of digits equals to the second one. Then you should eat it and make a wish.


123456 and 111222 are not happy tickets
123123 …

Sorted map vs hashed map

| category: Testing | author: st

In theory, hash map structure should be very fast on retrieving by key operations, close to O(1) like for an array. A sorted map (keys are sorted) should be O(log2 N) instead. The following test checks the difference.

Common scenario

We will use one tester class per …

Watching heap memory usage in Free Pascal/Delphi

| category: Testing | author: st
Tags: ,

Free Pascal (like Delphi) provide some useful functions to watch heap memory state in your application.

function GetHeapStatus: THeapStatus;

THeapStatus is documented here

Example of using this function is below

program ProgWatchMem;

  Math, FGL;

  TLongIntArr = array of LongInt; // LongInt is a 4-byte signed integer
  PLongIntArr = ^TLongIntArr;
  TMySortedMap = specialize …