-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some logic related to arc calculations to utilities namepsace.
- Loading branch information
Showing
7 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
namespace utilities | ||
{ | ||
bool doublesAreEqual(double left, double right); | ||
|
||
std::pair<int, int> getStartingAngles(int progressCounter); | ||
|
||
int getSpanAngle(); | ||
} // namespace utilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "UtilitiesTest.h" | ||
|
||
#include <QTest> | ||
|
||
#include "Utilities.h" | ||
|
||
void UtilitiesTest::testAnglesZeroProgress() | ||
{ | ||
auto [firstAngle, secondAngle]{utilities::getStartingAngles(0)}; | ||
QCOMPARE(firstAngle, 0); | ||
QCOMPARE(secondAngle, 2880); | ||
} | ||
|
||
void UtilitiesTest::testAnglesHalfProgress() | ||
{ | ||
auto [firstAngle, secondAngle]{utilities::getStartingAngles(50)}; | ||
QCOMPARE(firstAngle, 2880); | ||
QCOMPARE(secondAngle, 5760); | ||
} | ||
|
||
void UtilitiesTest::testAnglesFullProgress() | ||
{ | ||
auto [firstAngle, secondAngle]{utilities::getStartingAngles(100)}; | ||
QCOMPARE(firstAngle, 5760); | ||
QCOMPARE(secondAngle, 8640); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <QObject> | ||
|
||
class UtilitiesTest : public QObject | ||
{ | ||
Q_OBJECT | ||
private Q_SLOTS: | ||
static void testAnglesZeroProgress(); | ||
|
||
static void testAnglesHalfProgress(); | ||
|
||
static void testAnglesFullProgress(); | ||
}; |