mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
7b5ebdbb10
Replace the placeholder TestMaths (which only exercised Qt's QString::toUpper) with unit tests that cover production code: - TestMaths: degree/radian conversion, wrapAround, distance helpers, xOr - TestUtil: map_float/map_int range mapping and clipping, isNumeric, fileExists/eraseFile - TestUidAllocator: sequential allocation, lowest-id reuse, reserve, free - TestShape: vertex accessors, getCenter, includesPoint, translate, applyTransform, polygon round-trip The test project compiles the real MapMap sources under test and runs all suites from a single binary via a custom QtTest runner. Util.cpp uses glTexCoord2f and glVertex2f, which require -lopengl32 on Windows. The main project already links this via src.pri, but the test project manages its own linkage independently.
29 lines
635 B
C++
29 lines
635 B
C++
/*
|
|
* TestUidAllocator.h
|
|
*
|
|
* Unit tests for src/core/UidAllocator.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef TEST_UID_ALLOCATOR_H_
|
|
#define TEST_UID_ALLOCATOR_H_
|
|
|
|
#include <QtTest/QtTest>
|
|
|
|
class TestUidAllocator: public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void allocateIsSequential();
|
|
void freeReusesLowestId();
|
|
void reserve();
|
|
void freeUnknownReturnsFalse();
|
|
};
|
|
|
|
#endif /* TEST_UID_ALLOCATOR_H_ */
|