mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Split the giant test binaries into smaller unit tests
This is an intermediate step to have smaller unit tests. It is a trade off between having many many test executables compared to a few bigger ones. But this comes a lot closer to what QtTest is meant to be used.
This commit is contained in:
52
tests/blackmisc/testprocess/testprocess.cpp
Normal file
52
tests/blackmisc/testprocess/testprocess.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Copyright (C) 2016
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
#include "blackmisc/processinfo.h"
|
||||
#include "test.h"
|
||||
#include <QTest>
|
||||
#include <QCoreApplication>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
//! Testing process tools
|
||||
class CTestProcess : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
//! Process info tests
|
||||
void processInfo();
|
||||
};
|
||||
|
||||
void CTestProcess::processInfo()
|
||||
{
|
||||
CProcessInfo invalid;
|
||||
QVERIFY2(! invalid.exists(), "Invalid process shall not exist");
|
||||
|
||||
CProcessInfo current1(CProcessInfo::currentProcess());
|
||||
CProcessInfo current2(QCoreApplication::applicationPid());
|
||||
CProcessInfo current3(QCoreApplication::applicationPid(), QCoreApplication::applicationName());
|
||||
QVERIFY2(current1.exists(), "Current process shall exist");
|
||||
QVERIFY2(current1 == current2, "Current process equals process with current PID");
|
||||
QVERIFY2(current1 == current3, "Current process equals process with current PID and name");
|
||||
}
|
||||
}
|
||||
|
||||
//! main
|
||||
BLACKTEST_MAIN(BlackMiscTest::CTestProcess);
|
||||
|
||||
#include "testprocess.moc"
|
||||
|
||||
//! \endcond
|
||||
Reference in New Issue
Block a user