Skip to content

Instantly share code, notes, and snippets.

View rowlo's full-sized avatar

Robert Wloch rowlo

View GitHub Profile
@rowlo
rowlo / coverage generator
Last active December 18, 2015 22:48
Command to process a file pattern ${1} for creating a html coverage report.
lcov -d . -c -o coverage.info
lcov --list-full-path -e coverage.info ${1} -o coverage-stripped.info
genhtml -o html-coverage coverage-stripped.info
lcov -d . -z
@rowlo
rowlo / enable coverage in QtCreator project
Last active February 8, 2021 06:44
Enableing lcov code coverage analysis in QtCreator project file.
QMAKE_CXXFLAGS += -g -Wall -fprofile-arcs -ftest-coverage -O0
QMAKE_LFLAGS += -g -Wall -fprofile-arcs -ftest-coverage -O0
LIBS += \
-lgcov
@rowlo
rowlo / coverage run arguments template
Last active December 18, 2015 22:49
QtCreator run arguments template to testlib unti test executable:
-xml > testresults.out && /<path_to_script>/processCoverage.sh "*/<name_of_Qt_project_to_test>/src/*" && <browser_executable> html-coverage/index.html &
@rowlo
rowlo / coverage run arguments example
Last active December 18, 2015 22:49
Example run arguments line for QtCreator testlib unit test executable. Coverage is collected for "libRowloSqlitePersistence" project's source files and the generated html report is opened with the Opera browser:
-xml > testresults.out && /home/robert/bin/processCoverage.sh "*/libRowloSqlitePersistence/src/*" && /usr/bin/opera html-coverage/index.html &
@rowlo
rowlo / leapup.sh
Created July 25, 2013 20:08
That shell script starts the leapd service and the LeapControlPanel. When used as autostart script in Kubuntu all you need to do is plug in your Leap Motion controller and enjoy.
#!/bin/bash
/usr/bin/leapd &
/usr/bin/LeapControlPanel &
@rowlo
rowlo / buildObjectList()
Created January 2, 2014 11:34
Create a list of a million QTimer objects.
QList<QObject*> buildObjectList()
{
qint64 size = 10000000;
QList<QObject*> objectList;
for (int i = 0; i < size; i++)
{
objectList << new QTimer();
}
return objectList;
}
@rowlo
rowlo / ReverseStackOverflowOneLiner
Last active January 1, 2016 23:39
Reverse QList as suggested by Marc Jentsch
for(int k = 0; k < (list.size()/2); k++) list.swap(k,list.size()-(1+k));
@rowlo
rowlo / ReverseStackOverflowOneLinerWithMax
Created January 2, 2014 11:52
Reverse QList one-line with max initialization
for(int k = 0, max = (list.size()/2); k < max; k++) list.swap(k,list.size()-(1+k));
@rowlo
rowlo / timeReverseStackOverflowOneLinerWithMaxAndSize
Created January 2, 2014 11:55
Reverse QList one-line with max and size initialization
for(int k=0, s=list.size(), max=(s/2); k<max; k++) list.swap(k,s-(1+k));
@rowlo
rowlo / buildObjectListWithReserve()
Created January 2, 2014 12:09
Create a list of a million QTimer objects using reserve(int).
QList<QObject*> buildObjectListWithReserve()
{
qint64 size = 10000000;
QList<QObject*> objectList;
objectList.reserve(size);
for (int i = 0; i < size; i++)
{
objectList << new QTimer();
}
return objectList;