Qt Test limitations and workarounds

| category: Testing | author: st
Tags:

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 …

SQL Server: kill all database connections

| category: Programming | author: st
Tags:

How to kill all database connections before dropping it?

USE master;
GO
DECLARE @sql nvarchar(max);
WHILE 1=1 BEGIN
    SELECT TOP 1 @sql = N'KILL ' + convert(nvarchar(10), spid)
    FROM sysprocesses WHERE dbid = DB_ID('my_database');
    IF @@rowcount = 0  BREAK;
    EXEC sp_executesql @sql;
END;
DROP DATABASE IF EXISTS my_database;

C++11 constructors

| category: Programming | author: st
Tags: ,

According to specification, "...constructor is a special non-static member function of a class that is used to initialize objects of its class type". In addition to basic concepts, C++11 introduces move constructors, initializer list type and brace-enclosed lists of comma-separated initializers.

However the impact of introducing new constructors combining …

C++11 containers: move semantic vs pointers

| category: Testing | author: st
Tags: ,

Motivation

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 …