31 lines
613 B
C++
31 lines
613 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "metrics.h"
|
|
#include "utiltime.h"
|
|
|
|
|
|
TEST(Metrics, GetLocalSolPS) {
|
|
SetMockTime(100);
|
|
MarkStartTime();
|
|
|
|
// No time has passed
|
|
EXPECT_EQ(0, GetLocalSolPS());
|
|
|
|
// Increment time
|
|
SetMockTime(101);
|
|
EXPECT_EQ(0, GetLocalSolPS());
|
|
|
|
// Increment solutions
|
|
solutionTargetChecks.increment();
|
|
EXPECT_EQ(1, GetLocalSolPS());
|
|
|
|
// Increment time
|
|
SetMockTime(102);
|
|
EXPECT_EQ(0.5, GetLocalSolPS());
|
|
|
|
// Increment solutions
|
|
solutionTargetChecks.increment();
|
|
solutionTargetChecks.increment();
|
|
EXPECT_EQ(1.5, GetLocalSolPS());
|
|
}
|