mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 19:03:43 +00:00
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch: accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes they need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.1 KiB
C++
26 lines
1.1 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include "PlayerReports.h"
|
|
#include "DashboardNotify.h"
|
|
|
|
TEST(PlayerReportsLimitTests, FewPerMinuteAndPerDay) {
|
|
PlayerReports::RateLimit limit;
|
|
for (size_t i = 0; i < PlayerReports::RateLimit::PER_MINUTE; i++) EXPECT_TRUE(limit.Allow(1, 1000));
|
|
EXPECT_FALSE(limit.Allow(1, 1010)); // same minute
|
|
EXPECT_TRUE(limit.Allow(2, 1010)); // another account is separate
|
|
EXPECT_TRUE(limit.Allow(1, 1061)); // a minute later
|
|
|
|
PlayerReports::RateLimit daily;
|
|
int64_t time = 0;
|
|
for (size_t i = 0; i < PlayerReports::RateLimit::PER_DAY; i++, time += 61) EXPECT_TRUE(daily.Allow(5, time));
|
|
EXPECT_FALSE(daily.Allow(5, time));
|
|
EXPECT_TRUE(daily.Allow(5, 24 * 60 * 60 + 1)); // the oldest is a day old
|
|
}
|
|
|
|
TEST(DashboardNotifyTests, AnnouncementChatLine) {
|
|
EXPECT_EQ(DashboardNotify::ChatLine("Server restart", "In 5 minutes."), "Server restart: In 5 minutes.");
|
|
EXPECT_EQ(DashboardNotify::ChatLine("Challenge complete!", "Builders: 100 bricks!"), "Challenge complete! Builders: 100 bricks!");
|
|
EXPECT_EQ(DashboardNotify::ChatLine("Ready?", "Go"), "Ready? Go");
|
|
EXPECT_EQ(DashboardNotify::ChatLine("", "Just text"), "Just text");
|
|
}
|