1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-06 10:47:44 +00:00
astra/autotests/crtrandtest.cpp
Joshua Goins ea262ddfb7
Support Steam service accounts (#32)
This adds support for Steam service accounts, finally. Requires an updated steamwrap, and we're missing the infrastructure to launch it at the moment too.
2025-05-04 16:57:29 -04:00

44 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2025 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include <QtTest/QtTest>
#include "crtrand.h"
class CrtRandTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void randomSeed_data()
{
QTest::addColumn<uint32_t>("seed");
QTest::addColumn<uint32_t>("value1");
QTest::addColumn<uint32_t>("value2");
QTest::addColumn<uint32_t>("value3");
QTest::addColumn<uint32_t>("value4");
QTest::addRow("test 1") << static_cast<uint32_t>(5050) << static_cast<uint32_t>(16529) << static_cast<uint32_t>(23363) << static_cast<uint32_t>(25000)
<< static_cast<uint32_t>(18427);
QTest::addRow("test 2") << static_cast<uint32_t>(19147) << static_cast<uint32_t>(29796) << static_cast<uint32_t>(24416) << static_cast<uint32_t>(1377)
<< static_cast<uint32_t>(24625);
}
void randomSeed()
{
QFETCH(uint32_t, seed);
QFETCH(uint32_t, value1);
QFETCH(uint32_t, value2);
QFETCH(uint32_t, value3);
QFETCH(uint32_t, value4);
auto crtRand = CrtRand(seed);
QCOMPARE(crtRand.next(), value1);
QCOMPARE(crtRand.next(), value2);
QCOMPARE(crtRand.next(), value3);
QCOMPARE(crtRand.next(), value4);
}
};
QTEST_MAIN(CrtRandTest)
#include "crtrandtest.moc"