Skip to content

Commit

Permalink
Trying to fix sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed May 12, 2024
1 parent 1e23484 commit 395b1b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/cppunit/interval_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <gtest/gtest.h>

#include <random>

#include "search/ir.h"

using namespace kqir;
Expand Down Expand Up @@ -68,8 +70,12 @@ TEST(IntervalSet, Simple) {
IntervalSet({2, 5}) | IntervalSet({7, 8}));
ASSERT_EQ(~IntervalSet({2, 8}), IntervalSet({IntervalSet::minf, 2}) | IntervalSet({8, IntervalSet::inf}));

std::uniform_real_distribution<double> dist;
// Using random seed 0
std::mt19937 rand_gen(0);
for (auto i = 0; i < 2000; ++i) {
auto gen = [] { return static_cast<double>(std::rand()) / 100; };
// generate random double
auto gen = [&dist, &rand_gen] { return dist(rand_gen); };
auto geni = [&gen] {
auto r = std::rand() % 50;
if (r == 0) {
Expand Down

0 comments on commit 395b1b2

Please sign in to comment.